Pretty close to what Linlin suggest but using a RegEx to match more precisely the variables you want renamed - and using Proc Datasets instead of a Data Step to do the renaming (and so avoiding a full pass through the data). data class; set sashelp.class; newage1=age; newweight1=weight; newheight1=height; run; proc sql noprint; select cats(name,'=',prxchange('s/(.+)(1\b)/$1/o',1,name)) into : list separated by ' ' from dictionary.columns where libname='WORK' and memname='CLASS' and prxmatch('/.+1\b/',name) ; quit; proc datasets lib=work nolist; modify class; rename &list; ; quit;
... View more