I have my proc report all set up, but there is one problem. The male header spans into my total column. All the values are correct, but the total column is a total of female and male students. I need to find a way to separate it from the male spanned header.
Here is my code below:
proc report data=work.pivottest style(header)={just=c}; columns FTICFlag TermDescription, GenderDescription, (StudentCount StudentPct TermTotal); define FTICFlag / group 'FTIC Indicator'; define TermDescription / across 'Term'; define GenderDescription / across 'Gender'; define StudentCount / analysis sum 'Enrolled'; define StudentPct / computed format=percent12.2 '%'; define TermTotal / computed nozero 'Total'; /***********Column Map*************/ /* C1 = FTIC Ind */ /* C2 = Female Enrolled */ /* C3 = Female % */ /* C4 = Hidden Subtotal */ /* C5 = Male Enrolled */ /* C6 = Male % */ /* C7 = Subtotal */ /* C8 = Female Enrolled */ /* C9 = Female % */ /* C10 = Hidden Subtotal */ /* C11 = Male Enrolled */ /* C12 = Male % */ /* C13 = Subtotal */ /**********************************/ compute StudentPct; /* 1st Term Female Enrolled % */ _c3_ = _c2_ / (_c2_+_c5_); /* 1st Term Male Enrolled % */ _c6_ = _c5_ / (_c2_+_c5_); /* 2nd Term Female Enrolled % */ _c9_ = _c8_ / (_c8_+_c11_); /* 2nd Term Male Enrolled % */ _c12_ = _c11_ / (_c8_+_c11_); endcomp; compute TermTotal; /*First Term Total Students */ _c7_ = _c2_ + _c5_; /*Second Term Total Students */ _c13_ = _c8_ + _c11_; endcomp; run;
Is this possible?
Hi:
It would have been nice if you had provided some fake data to run with. In the absence of any data, I made some fake data, which may or may not be like your numbers:
But you need to "rearrange" the order of the items in your COLUMN statement, which will change the absolute column numbers, but I think this is closer to what you want:
Cynthia
Hi:
It would have been nice if you had provided some fake data to run with. In the absence of any data, I made some fake data, which may or may not be like your numbers:
But you need to "rearrange" the order of the items in your COLUMN statement, which will change the absolute column numbers, but I think this is closer to what you want:
Cynthia
Thank you, that was exactly what I was looking for.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.