/* This program changes all the names of your variables to CAPS or to small letters. Handy. Put in dataset, and either U or L. This program also allows you to search an replace specific characters in the field names. For example, if you don't like the '_' letter, replace it with 'X'. */ OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR SYMBOLGEN; data mydata; input y va_R_1 var2 Var_3; cards; 1 10 33 4 0 20 21 3 1 30 59 2 1 20 76 1 0 20 24 3 0 . 30 2 1 10 28 2 1 10 49 2 0 30 76 4 1 20 59 2 ; %macro VARCASE(dsn,case,str_from,str_to); %global ds; %let ds=%sysfunc(open(&dsn,i)); %do i=1 %to %sysfunc(attrn(&ds,NVARS)); %let dsvn&i=%sysfunc(VARNAME(&ds,&i)); %if &case=L %then %let vn&i=%sysfunc(translate(%qlowcase(&&dsvn&i),&str_to,&str_from)); %else %let vn&i=%sysfunc(translate(%qupcase(&&dsvn&i),&str_to,&str_from)); %end; %let rc=%sysfunc(close(&ds)); data NEWDATA; set &dsn; %let ds=%sysfunc(open(&dsn,i)); %do i=1 %to %sysfunc(attrn(&ds,NVARS)); rename &&dsvn&i=&&vn&i; %end; %let rc=%sysfunc(close(&ds)); run; %mend VARCASE; %VARCASE(mydata,U,_,X); title NEW DATA; proc print data=newdata;run;