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 

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
  • 1150 views
  • 0 likes
  • 4 in conversation