如果医院收费项目不多的话,手动下吧,说实在的,我写完这段 自己都恶心了
data a;
length FAMILY_NO $20. ITEM_NAME $10. ;
input FAMILY_NO ITEM_NAME COSTS @@;
cards;
4307030620010014 注射费 14
4307030620010014 B超 58
4307030620010014 诊疗费 22
4307030620010015 诊疗费 22
4307030620010016 护理费 74
4307030620010016 床位费 14
4307030620010016 维生素B2 2.6
4307030620010016 氯化钠 0.7
4307030620010017 葡萄糖酸钙 10.8
;run;
data b;
set a;
ARRAY x(8) x1-x8;
DO i = 1 TO 8;
x(i) =0;
END;drop i item_name costs;
if item_name="注射费" then x1=costs ;
if item_name="B超" then x2=costs;
if item_name="诊疗费" then x3=costs;
if item_name="护理费" then x4=costs;
if item_name="床位费" then x5=costs;
if item_name="维生素B2" then x6=costs;
if item_name="氯化钠" then x7=costs;
if item_name="葡萄糖酸钙" then x8=costs;
run;
proc sql;
create table final as
select FAMILY_NO,
sum(x1) as x1 label= "注册费" ,
sum(x2) as x2 label= "检查费" ,
sum(x3) as x3 label= "诊疗费",
sum(x4) as x4 label= "护理费",
sum(x5) as x5 label= "床位费",
sum(x6)+sum(x7)+sum(x8) as x6 label= "药费"
from b group by family_no;
quit;


雷达卡



京公网安备 11010802022788号







