- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Good Morning,
I'm looking almost all day how to copy sas log into a text file, but without erasing it into sas (no proc printto, or maybe if some option exists…)
I need this code to be inside my sas program and not executed into linuy command line (or of course in a linux command line into my sas program)
I would like to be in my sas enterprise guide session, run my project (or program) and then see the logs into sas, but also save them (automatically) in a text file.
I saw on internet the altlog option, but I didn't manage to make it work...
Hope somebody could help me.
Thank you,
Sabrina
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Code Direct Log to the External Log file , Reads and displays the external file and displays it in the Log Window in the same session. Let me know if this works.
/* Specify the path for the external log */
*Specify the Path;
%let path=<Your_Path>/sample.log;
* Export Log to Extrenal Path;
proc printto log="&path.";
run;
*Specify Your SAS Code Here;
data Sample;
set sashelp.class;
run;
proc print data=Sample;
run;
proc printto log=log; run;
*Read the Log from the External file and Display in the Log Window;
data _null_;
infile "&path.";
input;
putlog ">" _infile_;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
https://communities.sas.com/t5/SAS-Programming/Implement-altlog-in-the-code/td-p/171808
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I cannot manage to make the altlog work… If I understood it correctly, sas must be triggered in batch right ?
I'm looking for a solution that can be written in the sas script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Next up: Rick Wicklin presents Ten Tips for Effective Statistical Graphics (with SAS code) on Wednesday March 26.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Code Direct Log to the External Log file , Reads and displays the external file and displays it in the Log Window in the same session. Let me know if this works.
/* Specify the path for the external log */
*Specify the Path;
%let path=<Your_Path>/sample.log;
* Export Log to Extrenal Path;
proc printto log="&path.";
run;
*Specify Your SAS Code Here;
data Sample;
set sashelp.class;
run;
proc print data=Sample;
run;
proc printto log=log; run;
*Read the Log from the External file and Display in the Log Window;
data _null_;
infile "&path.";
input;
putlog ">" _infile_;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you r_behata,
It's a good idea, but doing like this we lose the fonctionality of seen the errors and warning in the bottom bar.
See the picture below
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
putlog _infile_;
it works !