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?
Asked
Active
Viewed 59 times
0
-
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. – Reeza Feb 23 '17 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;` – Allan Bowe Feb 23 '17 at 14:54
-
What about `filename email`? – Joe Feb 23 '17 at 15:05
-
Thanks and sorry dears, I'm new in SAS and in stack**overflow** too. I'm going to accept the answer (if I can). – cinghio Feb 24 '17 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. – cinghio Feb 24 '17 at 11:43
1 Answers
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;

Quentin
- 5,960
- 1
- 13
- 21
-
-
@cinghio - you should accept this answer. For more details you can also review: http://stackoverflow.com/questions/40115153/how-to-have-sas-log-in-both-external-location-and-sas-enterprise-guide – Allan Bowe Feb 23 '17 at 14:52
-
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. – cinghio Feb 24 '17 at 11:47