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
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.
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.
Thanks. once i made sure log was getting generated, it worked fine.
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?
@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).
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!
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.
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.
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.
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.