options mstored sasmstore = reporter;
options papersize = a4 orientation = landscape;
libname reporter
%let dir = E:\2017\死因监测\总结\;
%let base = 11.csv; *大疫情死因系统导出死因数据;
%let ppl = population.xlsx; *大疫情系统基本信息系统导出人口数据;
%let icd = icd-10.xlsx;*icd-10分类表;
%let icdclass = code.xlsx;*三大类分类表;
%let table1 = table_ttl.csv;*大疫情系统导出死因报表卫统29-2报表合计及分性别;
%let table2 = table_male.csv;*;
%let table3 = table_female.csv;
%let rslt = rslt.rtf; *结果保存;
%let basefile = &dir&base; *11.csv文件路径;
%let pplfile = &dir&ppl;*人口文件路径;
%let icdfile = &dir&icd;*icd文件路径;
%let codefile = &dir&icdclass;*icd分类文件路径;
%let rsltfile = &dir&rslt;*结果保存路径;
%let table_ttl = &dir&table1;*卫统29-2合计及分男女文件路径;
%let table_male = &dir&table2;
%let table_female = &dir&table3;
*==============================================;
*-----------------生成死亡信息表----------------;
*==============================================;
proc import datafile="&basefile" out= work.base dbms=csv replace;
run;
data reporter.base;
set work.base(keep = var6 var8 var11 var12 var14
var16 var18 var20 var22 var23 var32 var34
var56 var57 var59 var61 var64 var66);
rename var6 = name /*死者姓名*/
var8 = gender /*性别*/
var11 = day_of_birth /*出生日期*/
var12 = age /*年龄*/
var14 = race /*民族*/
var16 = marriage /*婚姻状况*/
var18 = occup /*个人身份*/
var20 = edu /*文化程度*/
var22 = location /*生前详细地址*/
var23 = locid /*常住地址地区编码*/
var32 = day_of_death /*死亡时间*/
var34 = location_of_death /*死亡地点*/
var56 = cause_of_death /*根本死因*/
var57 = icd10 /*根本死因ICD编码*/
var59 = hospital_of_diagnosis /*最好诊断单位*/
var61 = diagnosis /*最高诊断依据*/
var64 = report_date /*医生填卡日期*/
var66 = reporter; /*填报单位名称*/
run;
*==============================================;
*------------------生成人口表-----------------;
*==============================================;
proc import datafile = "&pplfile" out = reporter.raw_ppl dbms = excel replace;
getnames = yes;
run;
*==============================================;
*------------------生成标化人口表---------------;
*==============================================;
data reporter.stdppl;
input grp std_male std_female std_ttl;
cards;
0 1.43 1.27 1.36
1 1.61 1.39 1.50
5 1.24 1.03 1.14
10 1.78 1.50 1.64
15 1.74 1.51 1.62
20 1.77 1.70 1.73
25 1.72 1.47 1.59
30 1.39 1.36 1.38
35 1.15 1.12 1.14
40 0.75 0.78 0.76
45 0.47 0.50 0.48
50 1.02 1.17 1.09
55 0.65 0.72 0.68
60 0.70 0.81 0.75
65 0.89 1.02 0.95
70 0.73 0.78 0.76
75 0.65 0.69 0.67
80 0.66 0.79 0.72
85 0.82 0.90 0.87
;
run;
*==============================================;
*-----------------生成ICD10表-------------------;
*==============================================;
proc import datafile = "&icdfile" out = reporter.icd dbms = excel replace;
getnames = yes;
run;
*==============================================;
*-----------------生成ICD10分类表---------------;
*==============================================;
proc import datafile = "&codefile" out = reporter.icdcode dbms = excel replace;
getnames = yes;
run;
*==============================================;
*-------------------死因统计数据处理------------;
*==============================================;
data reporter.base2;
set reporter.base;
*按照常住地址提取下一级行政区,本例中是乡镇级;
/* if index(location,"镇") > 0 then*/
/* town = substr(location, index(location,
/* if index(location,"乡") > 0 then*/
/* town = substr(location, index(location,
/* if index(location,"镇")+index(location,"乡") = 0 then town = "不详乡镇";*/
/* if town = "不详乡" then town = "不详乡镇";*/
/* rename reporter = hospital;*/
/* drop location ;*/
age2 = input(scan(age,1,"岁"),3.);
if _error_ = 1 then age2 = 0;
*age2 = intck(
*age2 = int(intck(
*age2 = int(intck(
if age2 = 0 then grp1 = 0;