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