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-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!

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.

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