I am the self-annointed worst macro writer. I am looking to have the following if then repeated for wide data to cover all diag1-54.
Here is the current code:
What I want is this code to go through diag1-diag54 per subject and make new variable Trauma = 1 for that subject if they have a diagnosis code within any of these ranges for any of the 54 diag variables.
Here is the current code:
Code:
data Diag_Trauma_Trunc;
set diag_wide_Hosp_Trunc;
If diag1 >= 80000 and diag1 < 090500 then Trauma = 1;
else if diag1 >= 92500 and diag1 < 93000 then Trauma = 1;
else if diag1 >= 94000 and diag1 <= 95990 then Trauma = 1;
run;