Help using Base SAS procedures

Indent Row Headers in Proc Tabulate

Reply
Contributor
Posts: 73

Indent Row Headers in Proc Tabulate

I have row headers in a table that look like:
Workers
{tab}Retired
{tab tab}Full Benefit
{tab tab}Reduced Benefit
{tab}Disabled

I need to use a Proc Format for these headers. Proc Tabulate usually ignores leading spaces. How do I get a tab or spaces to happen in the row headers in Proc Tabulate??
Super Contributor
Super Contributor
Posts: 3,174

Re: Indent Row Headers in Proc Tabulate

In some circumstances, I find that using a hex low-value of "00"X sometimes does what you need, at least until printing time.

Scott Barry
SBBWorks, Inc.
Regular Contributor
Posts: 171

Re: Indent Row Headers in Proc Tabulate

Use invisible characters. To insert a character into your program turn num lock on, hold down the alt key, type the digits 255 on the numeric keypad, then release the alt key.
Super User
Posts: 17,868

Re: Indent Row Headers in Proc Tabulate

Is it possible to use some of the traffic light format options to accomplish this? Mostly curious.
SAS Super FREQ
Posts: 8,743

Re: Indent Row Headers in Proc Tabulate

Hi:
ODS does not have the concept of a "tab" control.

Although the RTF specification DOES have a \TAB instruction -- the issue with the \TAB instruction is that different folks might have different TAB stops set in their word processor -- so that would not necessarily guarantee that the same amount of space was represented by a \TAB control string with RTF. I have seen folks insert a \TAB instruction into their RTF file using ODS -- but I prefer to use LEFTMARGIN or INDENT style attributes (INDENT or TEXTINDENT).

I generally start with INDENT and sometimes use LEFTMARGIN, as shown in Example 1 on page 9 of this paper:
http://www.lexjansen.com/pharmasug/2008/sas/sa08.pdf
created with the following syntax:
[pre]
style={font_weight=medium leftmargin=12pt}
[/pre]

This PROC TABULATE code will do an indent of the class level values for AGE using INDENT= or TEXTINDENT= (which are aliases for each other):
[pre]
ods listing close;

ods html file='c:\temp\tab_indent_use.html' style=sasweb;
ods rtf file='c:\temp\tab_indent_use.rtf';
ods pdf file='c:\temp\tab_indent_use.pdf';

proc tabulate data=sashelp.class;
class age / style={cellwidth=2in};
classlev age /style={cellwidth=2in font_weight=medium indent=20};
var height weight;
table age ,
height*mean weight*median;
run;

ods _all_ close;
[/pre]

For more information on the INDENT= (or TEXTINDENT=) option, look under the documentation topic entitled: "Style Attributes and Their Values".

cynthia
Contributor
Posts: 73

Re: Indent Row Headers in Proc Tabulate

Thanks, everyone, especially Cynthia and polingjw. A combination of both your ideas work for us. Cynthia, I looked at the paper you referenced about complex reports. You show some complex tables that have some features that we could use. You mention that the code is available at the SGF website. I have tried and failed to find it there. Could you please give a link, or email me the code for those tables? Thanks so much for all of your help!
SAS Super FREQ
Posts: 8,743

Re: Indent Row Headers in Proc Tabulate

Hi:
If you go to http://support.sas.com/rnd/papers/ you will get to the main site where papers by SAS staff are listed. The page is organized by year...and some descriptions just give a link to the published PDF and other descriptions give a link to download a zip file.

So if you go to the above web site, the quickest way to find my paper and the zip file that goes with it is to do a search in the browser for the word "Complex" and that should take you directly to the link for my paper. Alternately, you can scroll down to the section entitled "SAS Presentations at SAS Global Forum 2008" and my "Creating Complex Reports" section is the 8th presentation listed in that section.

cynthia
Ask a Question
Discussion stats
  • 6 replies
  • 980 views
  • 0 likes
  • 5 in conversation