BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8

Hi I would like to know how to export sas program log to a folder using sas code in a sas program

right now I have to manually export it and I would like to use sas code to have it automatically saved in a specific folder

 

please help thx

4 REPLIES 4
PaigeMiller
Diamond | Level 26
proc printto log="g:\abc\def\myfolder\filename.log" new;
run;

/* YOUR CODE GOES HERE */

proc printto;
run;

 

Note: the option NEW overwrites any previous logs by this name.

--
Paige Miller
Reeza
Super User
proc printto log="g:\abc\def\myfolder\filename %sysfunc(today(), yymmddn10.).log" new;
run;

/* YOUR CODE GOES HERE */

proc printto;
run;

 

You can also add the date (or datetime via datetime()) if you're looking to have this tracked each time you run a process.

Ksharp
Super User
If you are using PC version of SAS , you could try this:

option mprint mlogic symbolgen;
/*...................Here is code..........................*/
dm 'log; file "c:\temp\ReportPrint.log" replace;' ;
PaigeMiller
Diamond | Level 26

@HeatherNewton please mark an answer correct, if the answer works for you.

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 838 views
  • 1 like
  • 4 in conversation