@LightJade wrote: thank you. but what if I have case when billcode in ('A100', 'A101', 'A102', ..., 'A158' ) then 'Category 1' thank you!
I would solve such issues with a custom format:
data cntlin_ds;
fmtname = "billcode";
type = "C";
label = "category 1";
do i = 1 to 158;
start = "A" !! put(i,z3.);
output;
end;
run;
proc format cntlin=cntlin_ds;
run;
proc sql;
create table want as
select
put(billcode,$billcode.) as newvar
from have
;
quit;
Expand the first data step to cover other ranges, and possibly add one observation for "other" with hlo = "O".
... View more