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

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:

HitmonTran_0-1680810993879.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
 %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.

 

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

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.

Reeza
Super User
 %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.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1775 views
  • 0 likes
  • 4 in conversation