BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

I want to use proc report to display a summary table.

My question is how to merge cels with same Cat2 value into one cell?

It is important to keep the order of the rows same as in the summary table .

 

 

Data summaryinfo;
input Cat $ Cat2 $ reduce Customers;
cards;
e group1 -500 200
b group1  -300 300
Total group1 -800 500
c group2 -250 400
a group2  -200 100
d group2  -100 150
Total group2 -550 650
;
run;
proc report data=summaryinfo nowd 
style(header)={background=lightgrey};
column Cat Cat2 reduce Customers;
Define Cat /display;
Define Cat2 /display;
Define reduce /display;
Define Customers /display;
Run;
1 REPLY 1
ed_sas_member
Meteorite | Level 14

Hi @Ronein 

 

Does the "GROUP" and 'SPANROWS' option meet your expectations?

proc report data=summaryinfo nowd spanrows style(header)={background=lightgrey};
	column Cat Cat2 reduce Customers;
	Define Cat /display;
	Define Cat2 /group style(column)={vjust=m just=l};
	Define reduce /display;
	Define Customers /display;
Run;

 Capture d’écran 2020-03-11 à 10.32.51.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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 402 views
  • 1 like
  • 2 in conversation