你能帮助计算每个变量=1的每个变量的数量吗?我在这里发布了如何计算丢失的数字。希望这是类似的方式。提前致谢。
/*y00*/
%let list0=OCALZHMR OCARTERY OCARTH OCCHD OCDIABTS OCHBP OCMENTAL OCMYOCAR
OCOTHART OCPSYCH OCSTROKE;
/*y01 and y02*/
%let list1=D_CFAIL D_CHD D_HBP D_MYOCAR D_OTHHRT D_PSYCH D_RHYTHM D_STROKE
D_VALVE OCALZHMR OCARTERY OCARTH OCCHD OCDIABTS OCHBP OCMENTAL OCMYOCAR
OCOTHART OCPSYCH OCSTROKE;
proc means data=cohort00 nmiss noprint;
var &list0;
output out=y2000_nmiss(drop=_:) nmiss= ;
run;
proc means data=cohort01 nmiss noprint;
var &list1;
output out=y2001_nmiss(drop=_:) nmiss= ;
run;
data y2000_nmiss;
set y2000_nmiss;
j=1;
run;
data y2001_nmiss;
set y2001_nmiss;
j=1;
run;
proc transpose data=y2000_nmiss out=long0(rename=(COL1=Y2000 _name_=VAR));
by j;
run;
proc transpose data=y2001_nmiss out=long1(rename=(COL1=Y2001 _name_=VAR));
by j;
run;
data ATC_missing;
merge long0 long1;
by VAR;
drop j;
run;
这是丢失数量的输出表的一部分:
VARS Y2000 Y2001 Y2002
OCDIABTS 0 1 0
OCHBP 0 0 0
OCMENTAL 17 18 10
OCMYOCAR 0 0 0
OCOTHART 0 0 4758
OCOTHHRT . . .
OCPSYCH 0 0 0