The SAS Output Delivery System and reporting techniques

Proc Report Grand Total

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Proc Report Grand Total

[ Edited ]

 

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;


Accepted Solutions
Solution
‎04-13-2016 03:18 PM
Grand Advisor
Posts: 9,307

Re: Proc Report Grand Total

Use COMPUTE block instead of RBREAK.

 

Compute after ;
  Brkline="Grand Total :";
  StudentclassReport=brkline;
endcomp;

View solution in original post


All Replies
Grand Advisor
Posts: 9,682

Re: Proc Report Grand Total

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.

 

Solution
‎04-13-2016 03:18 PM
Grand Advisor
Posts: 9,307

Re: Proc Report Grand Total

Use COMPUTE block instead of RBREAK.

 

Compute after ;
  Brkline="Grand Total :";
  StudentclassReport=brkline;
endcomp;

Post a Question
Discussion Stats
  • 2 replies
  • 434 views
  • 1 like
  • 3 in conversation