BookmarkSubscribeRSS Feed
robm
Quartz | Level 8

I have 2 Proc tabulates where I am trying to show 2 different measure summed over different acacdemic year terms basically i am trying to sum in one

-the Tuition from each ALLOCATED_COLLEGE/SUBJECT_DESC for each column TERM_CODE  

-the Student count for each ALLOCATED_COLLEGE/SUBJECT_DESC for each column TERM_CODE  

 

IE I have change the VAR for each but they still sum exactly the same ...any suggestions? 

 

the output from below can be seen in the attached pdf

 

 

 

proc tabulate data=ROBM.TBIR1025 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
class ALLOCATED_COLLEGE SUBJECT_DESC TERM_CODE;
var INCLUDED_TUITION;
keylabel Sum = " ";
table (ALLOCATED_COLLEGE =' ') *(SUBJECT_DESC=' ' all='Total') all='Total', ((TERM_CODE=' ' all='Total')*((N=Amount))) /
contents = ' ' misstext=' ' box={label="ALLOCATED_COLLEGE/SUBJECT_DESC"};
run;
 
proc tabulate data=ROBM.TBIR1025 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
class ALLOCATED_COLLEGE 'SUBJECT_DESC'n 'TERM_CODE'n;
var STUDENT_COUNT;
keylabel Sum = " ";
table (ALLOCATED_COLLEGE =' ') *(SUBJECT_DESC=' ' all='Total') all='Total', ((TERM_CODE=' ' all='Total')*((N=Count))) /
contents = ' ' misstext=' ' box={label="ALLOCATED_COLLEGE/SUBJECT_DESC"};

 

5 REPLIES 5
LaurieF
Barite | Level 11

Can you provide some sample data? It's much easier to play around with the problem if there's something concrete to work on.

Astounding
PROC Star

You will have to learn a little more PROC TABULATE, I'm afraid.  You have never asked for the SUM of anything.  You only asked for the N statistic, which gives you a count of the nonmissing values.  So the count of the nonmissing values doesn't change.  You're allowed to ask for many different statistical measures, but you only get what you ask for.

robm
Quartz | Level 8

 

you aew right I building these of a EBI server 

 

  proc tabulate data=ROBM.TABBS99991 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
   class &showvarvalue &showvarvalue1 &acrossvarvalue;
   var &measurevar;
   keylabel Sum = " ";
   table &showby1exp &showby2exp &showvarall, (&acrossexp(&measureexp)) /
                  contents = ' ' misstext=' ' box={label="&boxlabel"};
  run;

and (&acrossexp(&measureexp)) should have just been (&measurevar)

 

 

 

 

  proc tabulate data=ROBM.TABBS99991 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
   class &showvarvalue &showvarvalue1 &acrossvarvalue;
   var &measurevar;
   keylabel Sum = " ";
   table &showby1exp &showby2exp &showvarall, (&measurevar) /
                  contents = ' ' misstext=' ' box={label="&boxlabel"};
  run;

 

 

 

 

 

  proc tabulate data=ROBM.TBIR1025 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
   class 'ALLOCATED_COLLEGE'n 'SUBJECT_DESC'n 'TERM_CODE'n;
   var STUDENT_COUNT;
   keylabel Sum = " ";
   table ('ALLOCATED_COLLEGE'n =' ') *('SUBJECT_DESC'n=' ' all='Total') all='Total', (('TERM_CODE'n=' ' all='Total')*((STUDENT_COUNT))) /
                  contents = ' ' misstext=' ' box={label="ALLOCATED_COLLEGE/SUBJECT_DESC"};
  run;


  proc tabulate data=ROBM.TBIR1025 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
   class 'ALLOCATED_COLLEGE'n 'SUBJECT_DESC'n 'TERM_CODE'n;
   var INCLUDED_TUITION;
   keylabel Sum = " ";
  table (ALLOCATED_COLLEGE = ' ') *(SUBJECT_DESC = ' ' all = 'Total') all='Total', ((TERM_CODE = ' ' all = 'Total')*((INCLUDED_TUITION))) /
                  contents = ' ' misstext=' ' box={label = "ALLOCATED_COLLEGE/SUBJECT_DESC"};
  run;

 

 

ArtC
Rhodochrosite | Level 12
Can we now assume that you are getting what you want?
robm
Quartz | Level 8

yup sorry I should have spent more time examining and understanding my PROC TABULATE 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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