0

I'd like to send my SAS log via email. I found a lot of documentation to do it by saving the log on the disk. I can't use this kind of approach because of file system restrictions. Would it be possible to redirect my log to a macro variable and put it in the email?

5
  • Macro vars have length restrictions such as 64k characters. PROC PRINTTO will redirect log to a specific text file and location and then you can email it as an attachment. Commented Feb 23, 2017 at 14:18
  • In short, you could write your log to a text file then load it into a macro variable, but it's not recommended (how would you deal with CRLFs / the 64k restriction etc). You DO have permission to write files to your work directory.. You can also use filename tmp temp; Commented Feb 23, 2017 at 14:54
  • What about filename email? Commented Feb 23, 2017 at 15:05
  • Thanks and sorry dears, I'm new in SAS and in stackoverflow too. I'm going to accept the answer (if I can). Commented Feb 24, 2017 at 11:34
  • Finally Allan Bowe was right. I have permissions but I was using (I suppose!) SAS steps that can only read/write file into a Windows file system (DM instead of PROC PRINTTO). My SAS pgm runs on a Unix server. Probably this misled me. Commented Feb 24, 2017 at 11:43

1 Answer 1

3

No I don't think you can redirect the log to a macro variable. But you always have write access to the work directory, so you can write it there, like:

proc printto log="%sysfunc(pathname(work))/mylog.log" new ;
run;
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, sad news!
@cinghio - you should accept this answer. For more details you can also review: stackoverflow.com/questions/40115153/…
Everything is fine now. I managed to write the file, I don't need "in-memory" log anymore. Anyway thanks for your help, now I know a new thing about SAS log.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.