BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bailunrui
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Vish33
Lapis Lazuli | Level 10

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;


INdent.jpg

View solution in original post

5 REPLIES 5
ballardw
Super User

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.

bailunrui
Fluorite | Level 6

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!

Vish33
Lapis Lazuli | Level 10

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;


INdent.jpg
bailunrui
Fluorite | Level 6

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

Vish33
Lapis Lazuli | Level 10

This can be further customized by creating formats.

--Vish

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3571 views
  • 0 likes
  • 3 in conversation