The SAS Output Delivery System and reporting techniques

Sub Header for totals

Reply
N/A
Posts: 0

Sub Header for totals

I have a list of totals that are split across a table by regions.

These totals conosists of recruitment and attrition figures and are broken down into 3 categories each.

Is it possible to have a sub header for all the recruitment totals - 'Recruitment' and similar for the attrition totals - 'Attrition'.

Also these in bold and set a bit to the left would be nice....


Thanks
SAS Employee
Posts: 174

Re: Sub Header for totals

Can you use ASCII art to show what you want the table to look like? If you use the
preformatted output tags (pre and /pre, both enclosed in square brackets), you can do
something like the below TABULATE output:

[pre]
-----------------------------------------------------------------------
| | Age |
| |---------------------------------------------------|
| | 13 | 14 |
| |-------------------------+-------------------------|
| | Height | Height |
| |-------------------------+-------------------------|
| | Sum | Mean | Sum | Mean |
|-----------------+------------+------------+------------+------------|
|Sex | | | | |
|-----------------| | | | |
|F | 121.80| 60.90| 127.10| 63.55|
|-----------------+------------+------------+------------+------------|
|M | 62.50| 62.50| 132.50| 66.25|
|-----------------+------------+------------+------------+------------|
|All | 184.30| 61.43| 259.60| 64.90|
-----------------------------------------------------------------------
[/pre]

-- David Kelley, SAS
N/A
Posts: 0

Re: Sub Header for totals

mikeymay

also very helpful would be a data step to load some sample data. (I would like to help, and think I can help, but with neither sample input not sample layout, most effort would be wasted :-(


PeterC
SAS Super FREQ
Posts: 8,740

Re: Sub Header for totals

Another thing to consider is that you can use SASHELP files, like SASHELP.SHOES or SASHELP.PRDSALE or SASHELP.CLASS to try to come up with a structure that you like and -then- the only thing that needs to be posted is the code and possibly a snippet of the output that you want to change. For example, if I use this PROC REPORT program on SASHELP.SHOES:
[pre]
options nodate nonumber nocenter;

proc report data=sashelp.shoes nowd;
where region in ('Asia', 'Africa', 'Canada')
and product contains 'Dress';
column region product sales;
define region /group;
define product / group;
define sales / sum;
break after region / summarize;
compute after region;
line ' ';
endcomp;
run;
[/pre]

I get this output:
[pre]
Region Product Total Sales
Africa Men's Dress $318,500
Women's Dress $374,308
Africa $692,808

Asia Men's Dress $119,366
Women's Dress $78,234
Asia $197,600

Canada Men's Dress $920,101
Women's Dress $989,350
Canada $1,909,451


[/pre]

Note how the region name is repeated on the summary line. If I wanted to CHANGE what appears on the summary line, perhaps instead of Asia,
I want to see Attrition Sum on the summary line:
[pre]
Region Product Total Sales
Africa Men's Dress $318,500
Women's Dress $374,308
Africa $692,808

Asia Men's Dress $119,366
Women's Dress $78,234
Attrition Sum $197,600

Canada Men's Dress $920,101
Women's Dress $989,350
Recruitment Sum $1,909,451

[/pre]

That is possible with a COMPUTE block in PROC REPORT. But, maybe you're using PROC TABULATE or PROC SQL -- without any idea of what
procedure you're trying to use or what your table structure looks like, it's very hard to come up with anything helpful.

cynthia

code that created last output is below
[pre]
proc report data=sashelp.shoes nowd;
where region in ('Asia', 'Africa', 'Canada')
and product contains 'Dress';
column region product sales;
define region /group;
define product / group;
define sales / sum;
break after region / summarize;
compute before region;
holdreg = region;
endcomp;
compute after region;
if holdreg = 'Asia' then region = 'Attrition Sum';
else if holdreg = 'Canada' then region = 'Recruitment Sum';
line ' ';
endcomp;
run;
[/pre]
Ask a Question
Discussion stats
  • 3 replies
  • 136 views
  • 0 likes
  • 3 in conversation