Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
options mprint;
%macro lowcase(dsn);
%let dsid=%sysfunc(open(&dsn));
%let num=%sysfunc(attrn(&dsid,nvars));
%put #
data &dsn;
set &dsn(rename=(
%do i = 1 %to #
/*function of varname returns the name of a SAS data set variable*/
%let var&i=%sysfunc(varname(&dsid,&i));
&&var&i=%sysfunc(lowcase(&&var&i)) /*rename all variables*/
%end;));
%let close=%sysfunc(close(&dsid));
run;
%mend lowcase;
%lowcase(data_with_uppercase_var_names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment