返回列表 发帖

[传染病] 碘盐年报表制作一段简单的SAS代码

[传染病] 碘盐年报表制作一段简单的SAS代码

碘盐年报表制作繁琐容易出错,因此我编写了一段简单的SAS代码,如有需要大家可以借鉴一下,非常荣幸能帮助到大家。
由于碘盐年报表的填写繁琐又容易出错,因此编写了如下sas代码: 目的: 1. 计算中位数 2. 计算非碘盐、碘盐、合格碘盐数 3. 计算尿碘频数分布
SAS代码如下:
data dy; input s d n; if d=0 then fdy=1; if d>=18 and d<=50 then hgdy=1; if n<20 then ndfb=1; else if n>=20 and n<50 then ndfb=2; else if n>=50 and n<100 then ndfb=3; else if n>=100 and n<300 then ndfb=4; else if n>=300 then ndfb=5; cards; 碘盐实验室相关数据 ; run; proc means median; var d n; by s; run; data dy2; set dy; by s; if first.s then fdy_s=0; if first.s then hgdy_s=0; fdy_s+fdy; hgdy_s+hgdy; a=fdy_s; dys=40-a; drop a ; if last.s then output; run; proc print data=dy2; run; proc freq data=dy; table s*ndfb/norow nocol nopercent; run;

返回列表