BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
3 REPLIES 3
David_SAS
SAS Employee
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
deleted_user
Not applicable
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
Cynthia_sas
SAS Super FREQ
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]

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 3 replies
  • 730 views
  • 0 likes
  • 3 in conversation