Maybe try if compress(disch_stat_cd) = '20'; etc. If the original has any spaces or other strange characters, then the comparisons might not work properly. Very often I find that e.g. ='7' does not work since the actual value is '7 ' with a space. I rarely use PROC SQL so I won't comment on that part. But I would troubleshoot first by checking the data_1f set: data data_1f check;
set inpt_hosp_1;
if age < 18 then flag = 1;
else select (disch_stat_cd);
when (‘20’) flag = 2;
when (‘7’) flag = 3;
when (‘02’,’05’,’09’,’30’,’43’,’66’,’69’) flag = 4;
when ('81','82','83','84','85','86','87','88','89','90','91','92','93','94','95') flag = 5;
otherwise flag = 0;
end;
output check;
if flag = 0 then output data_1f;
run; The number of records should be the same as what you are getting in data_1f. If not then there is an issue likely with how you are setting the flags. If it is the same, then there is something going on with your summary data step.
... View more