I have a dataset where all the variables end in "_c" and I'd like to now remove the suffix. However, I can't seem to find a way to do so. I found some code below using the scan feature, but it doesn't seem to work. Does anyone have an easy way to remove a suffix for all variables in a dataset? data contamination_c;
input id_c name_c :$10. age_c gender_c diagnosis1_c diagnosis2_c;
datalines;
112 Albert 10 85 90 89
223 Joe 11 99 98 91
323 Jim 12 100 100 100
414 Sally 11 78 89 100
;
run;
proc sql noprint;
select cats(name,'=',scan(name, 1, '_'))
into :suffixlist
separated by ' '
from dictionary.columns
where libname = 'WORK' and memname = 'contamination_c' and 'c' = scan(name, 2, '_');
quit;
... View more