I have a dataset like this, the dataset name is data1 PIN data1_S00 data1_ZC00 1 xxx xxx 2 xxx xxx I want to rename the variable if the variable name contains "S00" or "S96" or "S97" Here is the code I wrote, it does the job but it does a lot of unnecessary computation. The warning is like this "ERROR: Variable s805_S96 is not on file WORK.WANT", This variable is not even in the dataset, I don't know how to get rid of the warning. %macro rename(data1); data want_new; set want;run; proc sql noprint ; select cats(name,'=&data1') into :renames1 separated by ' ' from dictionary.columns where libname='WORK' and memname='WANT_NEW' and upcase(name) like '%_S00%' or upcase(name) like '%_S96%'; ; quit; proc datasets nolist library=work; modify want_new; rename &renames1; run; quit; %mend; %rename(data1);
... View more