Help using Base SAS procedures

proc tabulate

Reply
N/A
Posts: 0

proc tabulate

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.
SAS Super FREQ
Posts: 8,740

Re: proc tabulate

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]
Ask a Question
Discussion stats
  • 1 reply
  • 102 views
  • 0 likes
  • 2 in conversation