BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ArchanaSudhir
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

7 REPLIES 7
Reeza
Super User

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.

ArchanaSudhir
Obsidian | Level 7

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

 

 

Astounding
PROC Star

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?

FreelanceReinh
Jade | Level 19

@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).

Astounding
PROC Star

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!

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

ArchanaSudhir
Obsidian | Level 7

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.

sas-innovate-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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