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;
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.
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.
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.
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.