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
SAS Super FREQ

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
SAS Super FREQ

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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