BookmarkSubscribeRSS Feed
apple
Calcite | Level 5

How do I give the variables new names in Proc Tabulate, means?

Thanks

6 REPLIES 6
Ruchita
Calcite | Level 5

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 !!

apple
Calcite | Level 5


I don't understand. Where am I supposed to state the new names in the code?


I need it for Proc Freq


Thanks



ballardw
Super User

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.

apple
Calcite | Level 5

table var='Text to display', n;

What is n?

Thanks

RichardinOz
Quartz | Level 8

apple

In the case of Proc SQL it goes like this

...

Select ...

   stuff label = "New label for stuff" ,

   ...

Richard in NZ

ballardw
Super User

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.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 673 views
  • 0 likes
  • 4 in conversation