BookmarkSubscribeRSS Feed
archibald
Obsidian | Level 7
5 REPLIES 5
Reeza
Super User

A touch confused. 

Formats are used to control the display of a variables values. I've variable math has the values math101, math102

Labels are used to control the display of a variable name ie math='Mathematics'

 

Your output and description don't seem to match, which are you trying to do?

archibald
Obsidian | Level 7

Sorry about the confusion. only half ofthe ouput was displayed. 

anyway, this is how  my output looks like

        sum

math 124
phys  231
philo   79
grd   106
 
but I want 

                    sum

mathematics 124
physics          231
philosophy      79
grade            106

 

Reeza
Super User

Given your code try labels then, instead of format. 

 

If if that doesn't work please post a sample of your input data set. 

 

Label math='Mathematics';

stat_sas
Ammonite | Level 13

 

Formats will not be a solution for this. Just use variable labels in table statement to get the full text. Try this.

 

proc tabulate data=school ;
tables (math='mathematics' phys='physics' philo='philosophy' grd='grade')*sum*f=10.0, all ;
var math phys philo grd;
run;

 

Ksharp
Super User
proc tabulate data=school ;
tables (math='mathematics'  phys='physics'   philo='philosophy'  grd='grade' )*sum*f=10.0, all ;

var math phys philo grd;
run;

It is variable label, has nothing to do with FORMAT.

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
  • 5 replies
  • 855 views
  • 5 likes
  • 4 in conversation