BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kocianj
Calcite | Level 5

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.

 

Capture4.PNG

 

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

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:

term_fakedata.png

 

  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:

change_report_calcs_headers.png

 

Cynthia

View solution in original post

2 REPLIES 2
Cynthia_sas
Diamond | Level 26

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:

term_fakedata.png

 

  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:

change_report_calcs_headers.png

 

Cynthia

kocianj
Calcite | Level 5

Thank you, that was exactly what I was looking for.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 930 views
  • 1 like
  • 2 in conversation