DATA Step, Macro, Functions and more

proc format

Reply
Contributor
Posts: 62

proc format

Super User
Posts: 19,850

Re: proc format

Posted in reply to archibald

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?

Contributor
Posts: 62

Re: proc format

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

 

Super User
Posts: 19,850

Re: proc format

Posted in reply to archibald

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';

Trusted Advisor
Posts: 1,228

Re: proc format

Posted in reply to archibald

 

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;

 

Super User
Posts: 10,041

Re: proc format

Posted in reply to archibald
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.

Ask a Question
Discussion stats
  • 5 replies
  • 267 views
  • 5 likes
  • 4 in conversation