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

Good morning,
We are trying through SAS code in SAS Studio that a program that exports RTF file does the same with PDF file.
We can't run scripts. It would be only through code.

It had occurred to us to change the ods RTF option to ods PDF by putting all the code in a macro,
but the code is too dense to change each option. do you know any way?
Thank you very much and greetings.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

More details may be needed. Do you have more than one ODS RTF or ODS PDF statement?

 

You can generate both type of output if single ODS statements easily:

ods rtf file="<path>\documentname.rtf" <other rtf options>;
ods pdf file="<path>\documentname.pdf" <other pdf options>;

<one or more procs or data steps creating ods output>

ods pdf close;
ods rtf clsoe;

Which ods options are involved where? Details do matter. Even a skeleton of what you want to generate.

 

You might also investigate Proc Document which can be used to assemble already generated output into a single document. So generate all proc output and then use Proc Document to create the different versions.

 

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

This is what the macro language is made for.

Search all format-specific ODS statements and options, and make them conditional. Note that you do not need a macro definition for this, %IF %THEN %DO %EÑD %ELSE %DO %END can be used in "open code".

 

ballardw
Super User

More details may be needed. Do you have more than one ODS RTF or ODS PDF statement?

 

You can generate both type of output if single ODS statements easily:

ods rtf file="<path>\documentname.rtf" <other rtf options>;
ods pdf file="<path>\documentname.pdf" <other pdf options>;

<one or more procs or data steps creating ods output>

ods pdf close;
ods rtf clsoe;

Which ods options are involved where? Details do matter. Even a skeleton of what you want to generate.

 

You might also investigate Proc Document which can be used to assemble already generated output into a single document. So generate all proc output and then use Proc Document to create the different versions.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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