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