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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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