This is a sample code to RECODE multiple character variables into numeric variables i.e., assigning numeric values to each unique category of your character variable.
All you need to do is list all the character variables that you want to recode in the %let k = statement.
The problem with this approach is that you won’t be able to control which category of your character variables gets what number. The numeric values will be assigned in ascending order (starting with 1) and in alphabetical order of the categories of your character variable.
INPUT dishchdisp $ EDDISP $ DISSTATUS $;
burn burn death
death burn burn
burn death burn
%LET k = dishchdisp EDDISP DISSTATUS;
%LET i = 1;
%LET j = %scan(&k,&i);
PROC SORT DATA = complete;
IF first.&j THEN &j.n + 1;
%LET i = %EVAL(&i+1);