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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 668 views
  • 0 likes
  • 2 in conversation