BookmarkSubscribeRSS Feed
Pankp
Fluorite | Level 6

Dear All, I am looking for solution to display Value across column inside the report (like Merge&center functionality in excel) using proc report . Please find attached file. I would like to display "Total" text across the columns. Any inputs will be appreciated. Thanks

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Please show us a portion of the report you asked for via screen capture. Many of us will not download attachments.

--
Paige Miller
Pankp
Fluorite | Level 6
Col1 Col2 Result1 Result2 Total
A C xx xx xx
B A xx xx xx
C B xx xx xx
Total xx xx xx
Pankp
Fluorite | Level 6
Unfortunately, I could not replicate here but attachment should work to understand the exact need. Thanks
ballardw
Super User

Without the basic Proc Report code I would not even attempt to answer this question.

The specific Roles that you assign variables plus any appearance options used might conflict with a given attempted solution.

 

Better would be to provide an example data set, in the form of data step code plus the Proc Report code, OR use Proc report with a SAS supplied data set like SASHELP.CLASS or similar to create similar report.

ed_sas_member
Meteorite | Level 14

Hi @Pankp 

 

As far as I know, I don't think you can merge cells in the summarize line in PROC REPORT like in Excel for example.

However, you can enhance the report output by computing blocks and use a call define statement to alter the cell values and appearances.

E.g.

data have;
	input Col1 $ Col2 $ Result1 Result2;
	datalines;
A C 1 2
B A 1 2
C B 1 2
;
run;

proc report data=have;
	columns Col1 Col2 Result1 Result2 total;
	
	define Col1 / group;
	define Col2 / group;
	define Result1 / sum;
	define Result2 / sum;
	define total / computed 'Total';
	rbreak after / summarize;
	
	compute total;
		total = Result1.sum + Result2.sum;
	endcomp;
	
	compute Col1;
		if Col1 = "" then do;
			Col1 = "Total";
			call define (1, 'style', 'style=[borderrightcolor=white]');
		end;
	endcomp;
run;

Capture d’écran 2020-03-04 à 18.31.45.png

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1091 views
  • 0 likes
  • 4 in conversation