DATA Step, Macro, Functions and more

PROC printto - not generating log or output

Accepted Solution Solved
Reply
Contributor
Posts: 53
Accepted Solution

PROC printto - not generating log or output

HI,

 

I am trying to use proc printo in a macro. I have given proc printto in the beginning with 'filename &'  at the end -  just a proc printto.

 

my log and lst fiels have 0 bytes.

%Macro abc(filename=);

 

  proc printto file="&filename..lst"
   log="&filename..log" new;

run;

 

.....PROC Means; PROC COMPARE; etc...

 

proc printto;
run;

 %MEND abc;

 

Please advise as to why my log and output files are 0 bytes.

 

Thanks,

Archana


Accepted Solutions
Solution
‎03-03-2016 01:30 PM
Super User
Posts: 17,828

Re: PROC printto - not generating log or output

First - remove the proc printto and run the code. Does it execute properly? What does the log say?

Then re-add and see what happens. 

 

In your code above, I see the macro definition, but it's never called, that you've shown.

View solution in original post


All Replies
Solution
‎03-03-2016 01:30 PM
Super User
Posts: 17,828

Re: PROC printto - not generating log or output

First - remove the proc printto and run the code. Does it execute properly? What does the log say?

Then re-add and see what happens. 

 

In your code above, I see the macro definition, but it's never called, that you've shown.

Contributor
Posts: 53

Re: PROC printto - not generating log or output

Thanks. once i made sure log was getting  generated, it worked fine.

 

 

Super User
Posts: 5,082

Re: PROC printto - not generating log or output

Also note, PROC PRINTTO does not have an option called FILE=.  It uses PRINT= to designate the destination for the .lst file.  By any chance, were you ignoring error messages?  Or could you not see the log to be able to observe the error messages?

Trusted Advisor
Posts: 1,115

Re: PROC printto - not generating log or output

@Astounding: I would have agreed with your statement about FILE= vs. PRINT= and was surprised to see that FILE= is working. As it turned out, FILE= and NAME= are aliases to the PRINT= option (according to SAS 9.4 documentation).

Super User
Posts: 5,082

Re: PROC printto - not generating log or output

Not only are you right about that, but that behavior even goes back to SAS 9.2.  My only excuse:  I did check the documentation but didn't read far enough to see the Aliases.  That section is actually a little bit later.  My fault!

Super User
Super User
Posts: 7,401

Re: PROC printto - not generating log or output

Hi,

 

Out of interest, what is the goal of putting a printto within a macro statement?  Generally speaking to be an effective log it needs both the call of the macro, and the preceding steps, to make sense of the call - as noted by one of the responders here asking for the call of the macro.  To my mind, writing out lots of separate logs will just mak elife more complicated.  Keep it simple.

Contributor
Posts: 53

Re: PROC printto - not generating log or output

HI RW9,

 

I have to run 30 similar programs with slight variations. So I am using a macro with proc printto to generate different lst and outpuit so that I dont have to manually save.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 484 views
  • 1 like
  • 5 in conversation