Skip to content

Instantly share code, notes, and snippets.

@statgeek
Created May 10, 2017 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statgeek/6d5b69d8977fa6c2ee0654ac882d275c to your computer and use it in GitHub Desktop.
Save statgeek/6d5b69d8977fa6c2ee0654ac882d275c to your computer and use it in GitHub Desktop.
SAS - dynamically update labels to propcase
data class;
set sashelp.class;
label name="NAme" sex="GEndeR" age="Age" height="HeiGht" weight="kilograms";
run;
proc sql noprint;
select catx('=', name, quote(propcase(coalescec(trim(label), name))))
into :label_list separated by " " from sashelp.vcolumn where libname='WORK'
and upper(memname)='CLASS';
quit;
proc datasets lib=work nodetails nolist;
modify class;
label &label_list;
run;
quit;
proc print data=class label;
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment