IMO, changing pt_discharge from numeric to character is not necessary here.
You may recode this using Formats.
Untested code :
proc format;
value $ recode
-999 = "missing2"
12 = "homeH"
11 = "hospice"
10 = "otherD"
-9 = "missing"
-7 = "unknown"
-5 = "invalid"
9 = "otherH"
8 = "dead"
7 = "court"
6 = "long"
5 = "short"
4 = "LAMA"
3 = "admit"
1 = "home"
;
run;
proc sql;
create table pt_discstat as
select *,
put(pt_discharge,$recode.) as pt_recode
from pt_discharge_x
where pt_discharge in (-999, 12, 11 ,10, -9 ,-7 ,-5, 9, 8, 7, 6, 5, 4, 3, 1);
quit;
... View more