The SAS Output Delivery System and reporting techniques

PROC TABULATE and RTF - Indenting class levels

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

PROC TABULATE and RTF - Indenting class levels

My problem: when outputting my proc tabulate table to RTF, I lose the class level indentation.

See Comment #3 for a better illustration of my problem. Sorry for any confusion!

I am attempting to create a rather complex table with the following abridged code (no style info):

ODS RTF file="file.rtf"

PROC TABULATE data=mydata NOSEPS;

CLASS ID Day;

CLASSLEV Day;

VAR Var1 Var2;

TABLE (ALL ID),

(Var1 Var2)*(Day="" ALL="All"),

n*f=3.0 median*f=5.1 /MISSTEXT="NA" NOCONTINUED NOCELLMERGE INDENT=10 RTS=35 ROW=FLOAT BOX=[LABEL="Characteristic"] ;

RUN;

ODS RTF CLOSE

What I am getting:

CharacteristicNMedian
This is Analysis Var 1Level 1
Level 2
This is Analysis Var 2Level 1
Level 2

What I want:

CharacteristicNMedian
This is Analysis Var 1
Level 1
Level 2
This is Analysis Var 2
Level 1
Level 2

The code works in my listing output, but when I go to my RTF output, there are two separate columns.

Is there a fix for this? Thank you in advance for your assistance.


Best, Lauren

Message was edited by: Lauren Parlett to direct people to the better example in comment 3


Accepted Solutions
Solution
‎01-09-2014 04:54 AM
Frequent Contributor
Posts: 117

Re: PROC TABULATE and RTF - Indenting class levels

Hi,

You can do more customization with Proc Report for this.

Please find the attachment for output.

data s;

input country $ state $ Sales  Qty @@;

cards;

India AP 20000 1 India MP 40000 2 India UP 60000 3 US NY 100000 4 US CA 40000 2

;

run;

ods rtf file="/sasdata/INdent.rtf";

proc report data=s;

column country(state) sales qty;

define country /order noprint;

define state  /display "Country" style(header)={just=left}

                                  style(column)={just=left indent=25 width=1in font_size=8pt};

define Sales / "Sales";

define qty  / "Quantity";

compute before country/style={foreground=cx685c53 font_weight=bold just=l font_size=15pt};

    length myline $20;

    myline = country;

    line myline $20.;

  endcomp;

run;

ods rtf close;

View solution in original post

Attachment

All Replies
Grand Advisor
Posts: 9,748

Re: PROC TABULATE and RTF - Indenting class levels

It ;might help to show actual output. Since your syntax call for ALL plus the Variables ID and Day which do not appear in your output it gets hard to diagnose. OR supply some example data that generates the output.

Generally the behavior you are asking for is that of class variables where the Label of the first class variable would be "This is analysis var 1".

You don't say which version you are using but the documentation clearly states that the INDENT option only applies to the listing destination. You may get indenting a variety of ways, have the formatted values of the CLASS variables include leading space and use Classlev   /style=(asis=on)

or justify the classlev as right

BTW, NOSEPS and RTS only apply to listing destination as well.

Contributor
Posts: 23

Re: PROC TABULATE and RTF - Indenting class levels

I can definitely see how my example was confusing. Here is a better one:

      PROC TABULATE data=sashelp.bweight NOSEPS ;

      CLASS Boy Married;

      CLASSLEV Married;

      VAR ed weight;

      TABLE (ALL Boy),

                  (ed weight)*(Married ALL),

                  n*f=6.0

                  median*f=5.1

                  /MISSTEXT="NA" NOCONTINUED NOCELLMERGE INDENT=5 RTS=35 ROW=FLOAT;

      FORMAT boy married ynfmt.;

      RUN;


I've attached the listing output and my RTF output. Basically, I'd like the "yes" and "no" of the married category to be indented and underneath the ed and weight categories.

Thank you!

Attachment
Attachment
Solution
‎01-09-2014 04:54 AM
Frequent Contributor
Posts: 117

Re: PROC TABULATE and RTF - Indenting class levels

Hi,

You can do more customization with Proc Report for this.

Please find the attachment for output.

data s;

input country $ state $ Sales  Qty @@;

cards;

India AP 20000 1 India MP 40000 2 India UP 60000 3 US NY 100000 4 US CA 40000 2

;

run;

ods rtf file="/sasdata/INdent.rtf";

proc report data=s;

column country(state) sales qty;

define country /order noprint;

define state  /display "Country" style(header)={just=left}

                                  style(column)={just=left indent=25 width=1in font_size=8pt};

define Sales / "Sales";

define qty  / "Quantity";

compute before country/style={foreground=cx685c53 font_weight=bold just=l font_size=15pt};

    length myline $20;

    myline = country;

    line myline $20.;

  endcomp;

run;

ods rtf close;

Attachment
Contributor
Posts: 23

Re: PROC TABULATE and RTF - Indenting class levels

Thank you so much! You definitely have a point about PROC REPORT.

Frequent Contributor
Posts: 117

Re: PROC TABULATE and RTF - Indenting class levels

This can be further customized by creating formats.

--Vish

Post a Question
Discussion Stats
  • 5 replies
  • 967 views
  • 0 likes
  • 3 in conversation