How do I give the variables new names in Proc Tabulate, means?
Thanks
Dear Apple,
You can use rename option to give new names to the variables in Proc Tabulate and Means.
PROC TABULATE DATA=TRY OUT=TEST (RENAME=(N=Count));
CLASS VAR1 VAR2 VAR3;
TABLE VAR1 VAR2 VAR3;
RUN;
PROC MEANS DATA=TRY N MEAN MAX ;
OUTPUT OUT=TEST1 (RENAME=(_STAT_=COUNT1));
RUN;
Hope this helps !!
I don't understand. Where am I supposed to state the new names in the code?
I need it for Proc Freq
Thanks
If you want to display a different label for a variable then add a label statement to the proc
label var ='Text to display'; for example;
Or in tabulate you can override the default label in the table statement
table var='Text to display', n;
If you want the Values to display differently then a custom format may be in order.
table var='Text to display', n;
What is n?
Thanks
apple
In the case of Proc SQL it goes like this
...
Select ...
stuff label = "New label for stuff" ,
...
Richard in NZ
The n is was using Proc Tabulate syntax to show a count of the variable.
Note the Proc Freq processes labels differently than Proc tabulate. Freq will show the variable name and the label(if any) while tabulate only displays the label or the variable name if no label is assigned.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.