Help using Base SAS procedures

How can i create RTF file?

Accepted Solution Solved
Reply
Contributor
Posts: 21
Accepted Solution

How can i create RTF file?

[ Edited ]

Hi i have 3 different tabulate tables in here 

but i don't know how to create RTF output that i want to make.

And i want to make output pretty as much as possible through ODS function. 

 

Can you help me pls?

 

Here's my code:

 

title1 "median";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, median*(CURRENT_BALANCE weekint);
run;
*Question 1(e);
*For upper quartile 5%;
title1 "upper quartile";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, P95*(CURRENT_BALANCE weekint);
run;

*For lower quartile 5%;
title1 "lower quartile";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, P5*(CURRENT_BALANCE weekint);
run;

Here's my output how it looks like:

캡처.JPG캡처1.JPG

 


Accepted Solutions
Solution
‎09-23-2017 06:07 AM
Super User
Posts: 23,733

Re: How can i create RTF file?

ODS is pretty straightforward. 

Here's a link to the the ODS Cheat Sheet for RTF:

https://support.sas.com/rnd/base/ods/odsrtf/rtf-tips.pdf

 

Without know how you want to 'style' your RTF its difficult to help beyond this. 

 

This should get you started, rather than fully customize your style, I would suggest picking the style that's closes and modifying that. I find MEADOW and SEASIDE the best options for work reports, they're clear and not too flashy which looks juvenile. 

 

ods rtf file='/folders/myfolders/mySample.rtf' style=meadow;

title1 "median";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, median*(CURRENT_BALANCE weekint);
run;
*Question 1(e);
*For upper quartile 5%;
title1 "upper quartile";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, P95*(CURRENT_BALANCE weekint);
run;

*For lower quartile 5%;
title1 "lower quartile";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, P5*(CURRENT_BALANCE weekint);
run;

ods rtf close;

 

View solution in original post


All Replies
Solution
‎09-23-2017 06:07 AM
Super User
Posts: 23,733

Re: How can i create RTF file?

ODS is pretty straightforward. 

Here's a link to the the ODS Cheat Sheet for RTF:

https://support.sas.com/rnd/base/ods/odsrtf/rtf-tips.pdf

 

Without know how you want to 'style' your RTF its difficult to help beyond this. 

 

This should get you started, rather than fully customize your style, I would suggest picking the style that's closes and modifying that. I find MEADOW and SEASIDE the best options for work reports, they're clear and not too flashy which looks juvenile. 

 

ods rtf file='/folders/myfolders/mySample.rtf' style=meadow;

title1 "median";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, median*(CURRENT_BALANCE weekint);
run;
*Question 1(e);
*For upper quartile 5%;
title1 "upper quartile";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, P95*(CURRENT_BALANCE weekint);
run;

*For lower quartile 5%;
title1 "lower quartile";
proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, P5*(CURRENT_BALANCE weekint);
run;

ods rtf close;

 

Contributor
Posts: 21

Re: How can i create RTF file?

I have a question for locating file name.

Do i have to give them a name for physical data that i've referred to make
"proc tabulate data="?

Or is this arbitrary location that i will put my output as RTF after output?


If it's data name that i've used to create proc tabulate, i don't know how
to extract the address
cause it's in work as temporary file...:/


SAS Super FREQ
Posts: 9,368

Re: How can i create RTF file?

Hi:
There is a difference between what you specify on data= in a PROC step -- that is the name of the INPUT data set and what you specify on FILE= in the ODS statement -- that is the OUTPUT destination file or OUTPUT report file.

The data= reference is OK to be in WORK because after ODS is done making the output from PROC TABULATE, it does not need the WORK data any longer. You open the file name specified in the FILE= option to get the "pretty" or RTF version of the file.

You need to decide on what to use for the FILE= option -- that name is under your control -- where do YOU want to write the RTF file?

In an earlier post, you said: "And i want to make output pretty as much as possible through ODS function." Reeza gave you some good suggestions -- but what do you mean by "pretty" and what do you mean by "as much as possible" -- you need to make the font 24 pt and red?

Look at pages 18-21 of this paper: http://support.sas.com/resources/papers/proceedings13/366-2013.pdf -- it covers style overrides with PROC TABULATE -- by starting from a fairly garish example to show you exactly how to touch every area in a TABULATE report.

cynthia
Esteemed Advisor
Posts: 5,529

Re: How can i create RTF file?

You can also let proc tabulate generate the pages for you, for example:

 

ods rtf file="&sasforum.\Reports\tabulate report.rtf" style=journal;
options nodate nonumber;
Title "Sashelp.class statistics";
proc tabulate data=sashelp.class format=6.1;
class sex;
var height weight;
table 
    median="Median" p95="Upper quartile 5%" p5="Lower quartile 5%", 
    sex all, 
    height weight;
run;
ods rtf close;
PG
Super User
Posts: 10,784

Re: How can i create RTF file?

Another option.



ods tagsets.rtf file='c:\temp\x.rtf';
proc print data=sashelp.class;run;
ods tagsets.rtf close;


☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 390 views
  • 2 likes
  • 5 in conversation