BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

The following raw data table is a summary table that includes 4 categorical variables and 1 numeric variable.

It contains 42 rows.

I want to display the table in a different way where there is 2 dimensional table:

In X-axis there will be 2  categorical variables :Z1+Z2 (Z1 has 2 levels, Z2 has 3 levels)

In Y-axis there will be 2  categorical variables :Z3+Z4 (Z3 has 2 levels  ,Z4 has 3 levels)

When the value of a category is same for multiple cells then it is better to display it as one value

Data Report_tbl;
INFILE DATALINES DLM=',';
input Z4 $	Z3 $	Z2 $	Z1 $	Y ;
cards;
1,Max,None,None,10489
1,Max,30,20000,9437
1,Max,40,20000,8974
1,Max,50,20000,8443
1,Max,30,50000,8302
1,Max,40,50000,7358
1,Max,50,50000,6269
1.1,Max,None,None,9652
1.1,Max,30,20000,8275
1.1,Max,40,20000,7783
1.1,Max,50,20000,7678
1.1,Max,30,50000,6815
1.1,Max,40,50000,5809
1.1,Max,50,50000,8702
1.2,Max,None,None,8921
1.2,Max,30,20000,8055
1.2,Max,40,20000,7662
1.2,Max,50,20000,7204
1.2,Max,30,50000,7124
1.2,Max,40,50000,6331
1.2,Max,50,50000,5401
1,Second_Max,None,None,12121
1,Second_Max,30,20000,10801
1,Second_Max,40,20000,10266
1,Second_Max,50,20000,9671
1,Second_Max,30,50000,9363
1,Second_Max,40,50000,8267
1,Second_Max,50,50000,7036
1.1,Second_Max,None,None,11323
1.1,Second_Max,30,20000,10115
1.1,Second_Max,40,20000,9615
1.1,Second_Max,50,20000,9054
1.1,Second_Max,30,50000,8806
1.1,Second_Max,40,50000,7787
1.1,Second_Max,50,50000,6632
1.2,Second_Max,None,None,10605
1.2,Second_Max,30,20000,9493
1.2,Second_Max,40,20000,9026
1.2,Second_Max,50,20000,8496
1.2,Second_Max,30,50000,8291
1.2,Second_Max,40,50000,7342
1.2,Second_Max,50,50000,6258
;
run;

 

1 REPLY 1
andreas_lds
Jade | Level 19

Seems to be a problem solved by proc tabulate if you want a report. If you want a 2 dim table as dataset, i have to ask: why? That structure is hardly useful for any form of further processing.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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