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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.