BookmarkSubscribeRSS Feed
tSAS1
Obsidian | Level 7

Hello everyone!

I have this dataset in SAS :

Numvar1var1_var2var2_var3
A1A9A82
A1B1A82
A1C1A82
A2A25A221
A2B16B131
A2C17C71
A2C17D31
NoneA    

I want to know if there is any way to display it like this using proc report :

tSAS1_0-1619364193264.png

The idea is to merge cells of var1_ if they have the same value in var1 and Num

merge cells of var2_ if they have same value in var2 and Num

and merge cells in var3 if we have same value in Num variable.

 

I used the code below, but I didn't get the requested result:

proc report data=data  nowindows split='~' spanrows;
		column  Num var1 var1_ var2 var2_ var3;
define Num /order ORDER=DATA style(column)=[vjust=m just=l]missing; define var1 /display missing; define var1_ /display missing; define var2 /display missing; define var2_ /display missing ; define var3/order ORDER=DATA style(column)=[vjust=m just=l]missing; run;

Thank you in advance

1 REPLY 1
ballardw
Super User

The behavior you are showing comes when you use a GROUP role instead of DISPLAY.

 

But since the value you show for var2 of A belongs to different groups in Var1 they aren't going to merge because they are actually different groups.

 

If the columns must be in that order with specific cell merging that are different from cell merging to the left then proc report may not be the tool you need.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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