@kfluegge
If you're just after re-coding the values in prindiag then code like below should do (untested as no sample data provided).
proc format;
value $recodePrindiag (default=2)
'295' = '01'
'296' = '02'
'297' = '03'
'298' = '04'
'300' = '05'
'301' = '06'
'302' = '07'
'306' = '08'
'307' = '09'
'308' = '10'
'309' = '11'
'311' = '12'
'312' = '13'
'313' = '14'
'314' = '15'
other = '-1'
;
run;
data ip14aNTA;
set ip14;
prindiag_recoded=put(prindiag,$recodePrindiag.);
psyc_flag= (prindiag_recoded ne '-1');
run;
... View more