BookmarkSubscribeRSS Feed
tstjean
Calcite | Level 5

Is there a way to have the log information appear in the log window and have it output to an external text file.

8 REPLIES 8
PaigeMiller
Diamond | Level 26

You can always save the LOG window to a text file.

 

You can also use the ALTLOG option to cause this to happen automatically.

--
Paige Miller
DartRodrigo
Lapis Lazuli | Level 10

Hi mate,

 

The SAS Log appears as standard in SAS Softwares, but in Enterprise Guide, if you need to

see the whole SAS Log history, you need to go to the process flow, click on project log and

click turn on to store the history of SAS Log in that session.

If you need to export the SAS Log use the proc printto or export by point-and-clicking.

 

proc printto log='use_a_macro_to_get_the_log_automatically.log';
run;

If you need this to happen automatically, then put this code into insert custom code after

submitted code.

 

Att

tstjean
Calcite | Level 5

,

Thanks for the suggestions.

A little more detail from me would have helped.

I'm looking for a programmatic way to save the log file to an external text file.

And, if it is run interactively, to have the log also show in the log window.

I don't know if I can have my cake and eat it too by having the log automatically go to a text file and display in the log window.

From what I've read, it's one or the other.

Is this correct or can I have the log go to the window and a text file.

PaigeMiller
Diamond | Level 26

As I said, the ALTLOG option creates both the SASLOG in the LOG window, and a text file containing the SASLOG.

--
Paige Miller
DartRodrigo
Lapis Lazuli | Level 10

Jean, a sas code to do this is the proc printto like i said.

 

See this link: http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001330273.htm

 

Att

PaigeMiller
Diamond | Level 26

@DartibaliRodrigo wrote:

Jean, a sas code to do this is the proc printto like i said.

 

See this link: http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001330273.htm

 

Att


This does not meet the requirements stated. You don't get the log in BOTH the LOG window and in a text file. You only get the log in a text file.

 

The ALTLOG option does meet the requirements.

--
Paige Miller
Quentin
Super User

Agree with the altlog suggestion.  If you're on PC SAS, you can also use DM commands to copy the log to a file, e.g. :

 

 dm "log; file ""%sysfunc(pathname(work))/__mylog.log"" replace;";

 

Will write the contents of the log window to a file named __mylog.log in your work directory.  I do this for quick log scanning during interactive sessions.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
SASKiwi
PROC Star

I find it easier to run SAS programs in batch mode if I want a LOG file as it gets produced automatically. That way no code changes are required.

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
  • 8 replies
  • 1417 views
  • 1 like
  • 5 in conversation