Hello,
Running a complicated Proc Report. I have one final problem my grand total. I am currently using "rbreak after" to compute a grand total, but it is not working for my computed columns. Anyone have any ideas?
Thanks,
proc report data=FundingYear missing nowd completecols out=Nurse1;
where IOCategory="Nursing"
and semester in ("&Semester1" "&Semester2" "&Semester3" "&Semester4" "&semester5" "&Semester6") ;
column StudentclassReport Acad_Plan_Description CBM001major Sub_Plan_Description location IOCategory Semester,(student CBM001SCHAllStatefund)
FTSELast LastFunding FTSECurrent Currentfunding DiffFTE DIFFFund;
define StudentclassReport/ group order=data "Class Description";
define Acad_Plan_Description/ group "Academic Plan" ;
define CBM001major/ group "CIP" ;
define Sub_Plan_Description/ group "Academic Sub-Plan";
define location/ group "Location" ;
define IOCategory/group "I & O Category";
Define Semester/ across order=data "Semester";
Define student/ analysis sum "HeadCount";
Define CBM001SCHAllStatefund/ analysis sum "SCH";
define FTSELast/ computed "Last Base FTE";
define LastFunding/ computed "Fund Last";
define FTSECurrent/ computed "Current Base FTE";
define Currentfunding/ computed "Projected Funding";
define DiffFTE/ computed "Diff FTE";
define DIFFFund/ computed "Diff Funding";
break after StudentclassReport/ ol skip summarize suppress;
rbreak after /summarize ol ;
Compute after StudentclassReport;
Brkline=" Total for "|| trim(StudentclassReport);
StudentclassReport=brkline;
endcomp;
compute FTSELast;
If StudentclassReport="Undergraduates" then FTSELast=sum(_C8_,_C10_,_C12_)/30;
If StudentclassReport="Master's Level" then FTSELast=sum(_C8_,_C10_,_C12_)/24;
If StudentclassReport="Doctoral" then FTSELast=sum(_C8_,_C10_,_C12_)/18;
IF FTSELast=. then FTSELast=0;
endcomp;
compute LastFunding;
LastFunding=(FTSELast)*&NurWFTEf;
endcomp;
compute FTSECurrent;
If StudentclassReport="Undergraduates" then FTSECurrent=sum(_C18_,_C14_,_C16_)/30;
If StudentclassReport="Master's Level" then FTSECurrent=sum(_C18_,_C14_,_C16_)/24;
If StudentclassReport="Doctoral" then FTSECurrent=sum(_C18_,_C14_,_C16_)/18;
IF FTSECurrent=. then FTSECurrent=0;
endcomp;
compute Currentfunding;
Currentfunding=(FTSECurrent)*&NurWFTEf;
endcomp;
compute DiffFTE;
DiffFTE=FTSECurrent-FTSELast;
endcomp;
compute DIFFFund;
DIFFFund=Currentfunding-LastFunding;
endcomp;
compute StudentclassReport;
IF StudentclassReport NE ' ' then hold=StudentclassReport;
IF StudentclassReport EQ ' ' then StudentclassReport=hold;
if _break_ = '_RBREAK_' then
StudentclassReport = 'Grand Total';
endcomp;
run;
Use COMPUTE block instead of RBREAK.
Compute after ;
Brkline="Grand Total :";
StudentclassReport=brkline;
endcomp;
You should provide some example input data, preferably in the form of datastep code, values for the macro variables, and what you would expect the result to look like.
Use COMPUTE block instead of RBREAK.
Compute after ;
Brkline="Grand Total :";
StudentclassReport=brkline;
endcomp;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.