Hello,
I have a problem with this code; I don't understand why it does not pick fire-related incidents.
Steps a and b are to show whether the hospitalization is related to CO poisoning yes or no
step c is to identify fire-related CO poisoning; I think either step c or step f has a problem, but I am not sure what it is because I expect to see fire-related incidents, but as it is, it returns nothing for fire-related incidents.
All other parts seem to be working well!
If anyone can identify something that may be off, I would appreciate it!
* sub-step A;
substr(dx18,1,5) in ('T5801', 'T5804', 'T5811', 'T5814', 'T5891', 'T5894') or substr(dx17,1,6) in ('T582X1', 'T582X4', 'T588X1', 'T588X4') then COyes_step2a10 = 1;
* sub-step B;
substr(dx18,1,5) in ('T5802', 'T5803', 'T5812', 'T5813', 'T5892', 'T5893') or substr(dx17,1,6) in ('T582X2', 'T582X3', 'T588X2', 'T588X3') then COno_step2b10 = 1;
if COyes_step2a10 = 1 and COno_step2b10 ~= 1 then COpoisoning = 1;
* sub-step c;
substr(dx18,1,3) in ('X00', 'X01', 'X02', 'X03', 'X04', 'X05', 'X06', 'X08') then CO_fire10 = 1;
* sub-step d;
substr(dx18,1,5) in ('T5801', 'T5811', 'T5891') or substr(dx17,1,6) in ('T582X1', 'T588X1') then CO_nonfire_prelim10 = 1;
if CO_fire10 ~= 1 and CO_nonfire_prelim10 = 1 then CO_nonfire10 = 1;
* sub-step e;
substr(dx18,1,5) in ('T5804', 'T5814', 'T5894') or substr(dx17,1,6) in ('T582X4', 'T588X4') then CO_unknown_prelim1_10 = 1;
if CO_fire10 ~= 1 and CO_unknown_prelim1_10 = 1 then CO_unknown_prelim2_10 = 1;
if CO_fire10 = 1 and CO_nonfire10 = 1 then CO_unknown_prelim3_10 = 1;
if CO_unknown_prelim2_10 = 1 or CO_unknown_prelim3_10 = 1 then CO_unknown10 = 1;
* sub-step f;
if CO_fire10 = 1 then Cause = 1;*fire related ;
if CO_nonfire10 = 1 then Cause = 2;*not fire related;
if CO_unknown10 = 1 then Cause = 3;*Unknown mechanism or intent;
if CO_fire10 = 1 and CO_nonfire10 = 1 then Cause = 3;
if CO_fire10 = 1 and CO_unknown10 = 1 then Cause = 3;
if CO_nonfire10 = 1 and CO_unknown10 = 1 then Cause = 3;
HealthOutcomeID=3;
MonthlyHosp=0;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.