Hello I am trying to create a log file by using proc print but when I run my program it creates an rtf
%let analydir=\\Biostatistics\Analysis\ ;
ods tagsets.rtf(ID=l_chemo) file="&analydir.\Output\l_10_chemotherapy.rtf" style=myrtfn; *styles.rtfn;
proc report nowd /*headline*/ headskip split='*' data=blank spacing=1 missing ;
cols a;
define a / display '';
run;
ods tagsets.rtf(ID=l_chemo) close
ODS RTF close;
proc printto log="&analydir.\Log\l_10_chemo.rtf" NEW;
run;
RTF output:
%let analydir=\\Biostatistics\Analysis\ ;
proc printto log="&analydir.\Log\l_10_chemo.txt" NEW;
run;
ods tagsets.rtf(ID=l_chemo) file="&analydir.\Output\l_10_chemotherapy.rtf" style=myrtfn; *styles.rtfn;
proc report nowd /*headline*/ headskip split='*' data=blank spacing=1 missing ;
cols a;
define a / display '';
run;
ods tagsets.rtf(ID=l_chemo) close;
ODS RTF close;
PROC PRINTTO goes before your proc and you're missing a semicolon on one of your ODS statements.
LOG files have the text with the code you ran and the notes SAS generated.
What would that have to do with PROC PRINT?
And your posted code is not using PROC PRINT anyway. It is using PROC REPORT.
You can redirect the LOG messages using PROC PRINTTO, but you have to do it BEFORE the messages are generated, not after.
Just because you named the file you redirected the LOG to with a .rtf extension it will not make the content of the file be RTF code.
RTF files are tagged text files. Open the file with a good text editor (e.g. Notepad++) and you will see that the log is pure text.
%let analydir=\\Biostatistics\Analysis\ ;
proc printto log="&analydir.\Log\l_10_chemo.txt" NEW;
run;
ods tagsets.rtf(ID=l_chemo) file="&analydir.\Output\l_10_chemotherapy.rtf" style=myrtfn; *styles.rtfn;
proc report nowd /*headline*/ headskip split='*' data=blank spacing=1 missing ;
cols a;
define a / display '';
run;
ods tagsets.rtf(ID=l_chemo) close;
ODS RTF close;
PROC PRINTTO goes before your proc and you're missing a semicolon on one of your ODS statements.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.