Hello,
I am trying to calculate the percentage in proc tabulate for a group of colleges. I've created a sum, then a percentage of a column's total, but my output gives the total percentage based on the entire group of colleges and not an individual college.
title;
proc tabulate data=complement_master format=comma9.;
format FT $fte. level $lvl.;
var sch;
class COLLEGE level ft;
table (COLLEGE ALL)*(FT ALL='College Total'), SCH*LEVEL*(SUM COLPCTSUM="%"*f=BEST4.)
SCH ALL='Total'
/misstext='0' printmiss;
WHERE SUBJECTCOLL IN ('AR', 'BU');
title 'Table 4 - SCH by College, Type of Faculty and Level of Instruction, % WRONG';
quit;
The percentages should only be calculated for the college of "AR" and the College of "BU". Basically, sums and percentages for each college and a total summary for the entire school.
Am I making sense?
Also, I am using Base SAS 9.
You can specify a denominator class variable using pctn<classvar> or pctsum<classvar>. Do not use the <classvar> with rowpct or colpct statistics.
So you may be wanting Pctsum<college> instead of colpctsum.
But without any data its hard to be sure.
Thank you. I appreciate your time.
If I understand you correctly, I modified it a bit to show this:
title;
proc tabulate data=complement_master format=comma9.;
format FT $fte. level $lvl.;
var sch;
class COLLEGE level ft;
table (COLLEGE ALL)*(FT ALL='College Total'), (LEVEL ALL)*SCH*(SUM PCTSUM<COLLEGE ALL>="%"*f=BEST4.)
SCH ALL='Total'
/misstext='0' printmiss;
WHERE SUBJECTCOLL IN ('AR', 'BU');
title 'Table 4 - SCH by College, Type of Faculty and Level of Instruction, % WRONG';
quit;
I'm attaching the output table. The school Architecture is showing 18.3%. It is the percentage of FT (Full Time) to the Total college (1,163/6,357). It should be 1,163/1,527 or 76.2% . I've tried substituting or leaving out ALL in the <COLLEGE> classvar, but the error message is PctSum based is not in table. A PctSum crossing has no denominator.
Hello, I am facing the same issue ...was this resolved ?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.