BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
whs278
Quartz | Level 8

Is there way to use the variable names in PROC TABULATE instead of labels?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

If you remove the labels from the variable names, then all SAS PROCs (as far as I know) use the variable name.

 

Or

 

options nolabel;

which affects all PROCs until you turn it off.

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

If you remove the labels from the variable names, then all SAS PROCs (as far as I know) use the variable name.

 

Or

 

options nolabel;

which affects all PROCs until you turn it off.

--
Paige Miller
whs278
Quartz | Level 8

Thanks, this worked!

 

I was thinking there would be a NOLABELS options for PROC TABULATE as there is for PROC MEANS but there evidently isn't.  I guess this actually makes sense because it would be rare that you would prefer the variable name when using PROC TABULATE.  In any case, your solution worked. 

 

 

 

 

 

ballardw
Super User

Don't know if this helps as you don't say how many variables might be involved.

You can override the default label for any variable in a Table statement by using variablename='Label text' in Proc tabulate.

This works for statistics as well such as Sum='Sum of xxxx'

Example

proc tabulate data=sashelp.cars;
   class drivetrain;
   var mpg_city;
   tables drivetrain='Drivetrain',
          mpg_city='MPG'*mean;
run;

The above will display "Drivetrain" instead of "Drive Train" and "MPG" instead of assigned label of "MPG (City)";

Or provide a Label statement.

proc tabulate data=sashelp.cars;
   class drivetrain;
   var mpg_city;
   tables drivetrain,
          mpg_city*mean;
   label drivetrain='Drivetrain'
         mpg_city='MPG'
   ;

run;

The equivalent for statistics would be KEYLABEL: Keylabel mean='Average'; for example would display 'Average' for all mean statistics.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 2821 views
  • 1 like
  • 3 in conversation