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

Hi SAS experts,

 

 I used Infile statement to read the attached file that was generated using 'ods rtf', then I tried to use 'ods rtf+proc report' to output it. The rtf files turns out to be like the snap as below. data _null_+file statement is the only method I tried that is able to generate the right output, but here I don't know how to define format, like font using data _null_+file statement. Thanks again for your help!

 

Input file:

data readrtf;
    infile "L16.4.1.rtf" missover length=len end=fin
        lrecl=2000 ;
    input string $varying2000. len;

run;

 

 

Method data _null_+file:

 

data _null_;
        file "&loc.\Compiled.rtf" lrecl=2000 mod;
    set readrtf;
    put string;
run;

 

method ods rtf+proc report:

 

ods rtf file='file.rtf';

proc report data=readrtf nowd;

column string;

define string;

run;

ods rtf close;

 

Capture.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

So you are attempting to POST process rtf files and change something afterward? Was the original output done by SAS?

 

You may be more likely to have success with a Micro$oft VB macro. If you change the font outputing a data set like that with ODS you're only going to get an RTF document with a bunch of codes appearing with that font.

 

Or find the Font information buried in the raw rtf codes in that data _null_ search each line for the offending value and replace with the desired one. If you don't want to change every use of the font information then lots of luck with this approach.

 

If your original output was created by SAS then you may want to consider ensuring that the same style, style overides in procedures, or possibly create a custom style, is used to avoid that whole post process approach.

View solution in original post

3 REPLIES 3
ballardw
Super User

ODS RTF output is going to consider the text read into the SAS data set as character data that you want to show in the rtf document. Plus any of the report procs are going to add additional format based on the current style.

 

What is you are attempting to actually do?

File output with Put statements have NO information such as font type, size or color.

fbl204653
Obsidian | Level 7

Thanks ballardw! What I tried to do is , compling several rtf files that are generated by 'ODS RTF'+'Proc Report' like L16.2.4.1, at the same time, format like font for each file has to be the same as orignal files.

ballardw
Super User

So you are attempting to POST process rtf files and change something afterward? Was the original output done by SAS?

 

You may be more likely to have success with a Micro$oft VB macro. If you change the font outputing a data set like that with ODS you're only going to get an RTF document with a bunch of codes appearing with that font.

 

Or find the Font information buried in the raw rtf codes in that data _null_ search each line for the offending value and replace with the desired one. If you don't want to change every use of the font information then lots of luck with this approach.

 

If your original output was created by SAS then you may want to consider ensuring that the same style, style overides in procedures, or possibly create a custom style, is used to avoid that whole post process approach.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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