BookmarkSubscribeRSS Feed
RunningIR
Calcite | Level 5

 

After reviewing my report, I noticed my grand totals for my computed variables were incorrect. All of the subtotals are correct but the grand totals are higher than they should be. 

 


proc report data=FundingYear missing nowd completecols out=Nurse1;
where (IOCategory="Nursing" or (IOCategory="Biomedical Science" and acad_plan="PHD NURSE")) 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" format=comma20.;
define FTSELast/ computed "Last Base FTE" format=comma20.;
define LastFunding/ computed "Fund Last" FORMAT=dollar20.2;
define FTSECurrent/ computed "Current Base FTE" format=comma20.;
define Currentfunding/ computed "Projected Funding" FORMAT=dollar20.2;
define DiffFTE/ computed "Diff FTE" format=comma20.;
define DIFFFund/ computed "Diff Funding" FORMAT=dollar20.2;
break after StudentclassReport/ ol skip summarize suppress;
rbreak after /summarize ol ;

Compute after StudentclassReport;
Brkline=" Total for "|| trim(StudentclassReport);
StudentclassReport=brkline;
endcomp;

Compute after ;
Brkline="Grand Total :";
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;
If Acad_Plan_Description ne "PhD in Nursing" then LastFunding=(FTSELast)*&NurWFTEf;
else LastFunding=(FTSELast)*&GradWFTEf;

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;
If Acad_Plan_Description ne "PhD in Nursing" then Currentfunding=(FTSECurrent)*&NurWFTEf;
else Currentfunding=(FTSECurrent)*&GradWFTEf;

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;
endcomp;

run;

1 REPLY 1
ballardw
Super User

Without a data set this is very hard to evaulate. And the presence of macro variables without defined values makes it even more problematic to evaluate what may be going on with your code. You may also have to provide a comparion of which values are "incorrect" and what the expected value should be for given data.

 

If you could provide a small data step to create data that duplicates the overal behavior you'll likely get more help.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 853 views
  • 0 likes
  • 2 in conversation