BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I've a complicated table to produce with several subgroups. I have got so far by experimenting with the data formats etc but have come to a blank and wondered if anyone could help me?

The table format is...

group subgroup
group1 subgroup1
subgroup2
subgroup3
all
group2 subgroup1
subgroup2
subgroup3
all
overall subgroup1
subgroup2
subgroup3
all

sorry about the spacing..

I can get it to this except the subgroup label comes out for all groups and subgroups and I only want it at the top. The code I have used for ods output is

proc tabulate data=all;
class group subgroup1 subgroup2 subgroup3;
classlev group subgroup1 subgroup2 subgroup3;
var id var1 var2 var3 var4 var5;
table (group='group' all=[label='Overall'])
*(subgroup1='' subgroup2='' subgroup3='' all=[label='all']),
(var1='var1' var2='var2' var3='var3' var4='var4' var5='var5')*(N=''*f=3.);
run;

I can see one way to do this is to amend the subgroups to one super subgroup will all as part of it but want to use the raw data if possible.
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
I don't quite see what you mean by "subgroup label comes out for all groups and subgroups and I only want it at the top". When I use your code with some dummy data, I get the table shown below. Do you mean the word "group" or the word "all" or the word "Overall" in the table below. Or, do you want to make the top row header with "group" disappear entirely and place some information in the BOX area (above the row header area line)????

cynthia
[pre]
------------------------------------------------------------
| | var1 | var2 | var3 | var4 | var5 |
|-----------------------+------+------+------+------+------|
|group | | | | | | |
|-----------+-----------| | | | | |
|CANADA |EAST | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |WEST | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |FURNITURE | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |OFFICE | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |CHAIR | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |SOFA | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |all | 192| 192| 192| 192| 192|
|-----------+-----------+------+------+------+------+------|
|GERMANY |EAST | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |WEST | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |FURNITURE | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |OFFICE | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |CHAIR | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |SOFA | 96| 96| 96| 96| 96|
| |-----------+------+------+------+------+------|
| |all | 192| 192| 192| 192| 192|
|-----------+-----------+------+------+------+------+------|
|Overall |EAST | 192| 192| 192| 192| 192|
| |-----------+------+------+------+------+------|
| |WEST | 192| 192| 192| 192| 192|
| |-----------+------+------+------+------+------|
| |FURNITURE | 192| 192| 192| 192| 192|
| |-----------+------+------+------+------+------|
| |OFFICE | 192| 192| 192| 192| 192|
| |-----------+------+------+------+------+------|
| |CHAIR | 192| 192| 192| 192| 192|
| |-----------+------+------+------+------+------|
| |SOFA | 192| 192| 192| 192| 192|
| |-----------+------+------+------+------+------|
| |all | 384| 384| 384| 384| 384|
------------------------------------------------------------

[/pre]

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 797 views
  • 0 likes
  • 2 in conversation