This post was kindly contributed by StudySAS Blog - go there to comment and to read the full post. |
option VALIDVARNAME=UPCASE;
Use trhe above option statement to upcase the variable name of the SAS dataset irrespective of type of variable in the dataset (character or numeric).
The following example shows how the option sattement VALIDVARNAME=UPCASE works.
proc contents data=sashelp.class out=test;
run;
Note: Propcase variable names.
*Upcasing the variables;
option validvarname=upcase;
proc sort data=sashelp.class out=test; run;
Because of the option statement. Ex: ‘Age’ becomes ‘AGE’ and ‘Height’ becomes ‘HEIGHT’ etc.
See the SAS Language Reference dictionary to get more details.
Another way to do this is to use a macro and I call it as UPCASE macro.
proc sort data=sashelp.class out=test;
by name;
run;
%macro upcase (lib,dsn);
*Create a macro variable with the total number of variable count;
data _null_;
set sashelp.vtable(where=(libname=”&LIB” and…
[[ This is a content summary only. Visit my website for full links, other content, and more! ]]
This post was kindly contributed by StudySAS Blog - go there to comment and to read the full post. |