BookmarkSubscribeRSS Feed
Rushikeshvm
Calcite | Level 5

Hi All,

 

I am working on SAS Studio and I have an issue.

 

I wish to create a SAS macro that will read the SAS log of the current program and check it for any issues. I have gone through various papers but all of them refer to the external file saved as *.log.

 

What is the option or procedure to read the SAS log of my current program and check for the issues?

 

Thanks,

Rhushikesh 

7 REPLIES 7
Kurt_Bremser
Super User

None. But you can check the automatic macro variables &syscc, &syserr and so on.

 

Alternatively, you could configure the workspace server logging so that a more expanded logfile is written on the server, and read that. But that requires write permissions for the SAS configuration and in-depth knowledge for the changes in logconfig.xml. Or the cooperation of your SAS admin.

Rushikeshvm
Calcite | Level 5

Thank you very much for your inputs. So, we don't have a procedure to extract the log of the current program.

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

@Rushikeshvmif you happen to find a nice way to read extremely long SAS log into SAS datasets let the rest of know.  I have been working with the same request and mining for words is a real pain.  I have ran into issue with memory overflow, and those tailored process that do seem to work at time don't always work on other log layouts,

Shmuel
Garnet | Level 18

1) You can save the log of any part of your program or the whole log using PROC PRINTTO.

    Start with proc printto log=<path and filename>; run;

    Close the log with: rproc printto; run;

    then read the file and check it using text functions like: scan, index, find etc.

 

2) You can check, instream the program or by special step, are there any errors by

     checking system macro variables: &sysrc, &syserr - and some more (check in SAS documentation). 

Rushikeshvm
Calcite | Level 5

Thank You,

 

But I am looking for a way to read the log of the current program the time it executes.

Kurt_Bremser
Super User

EG and SAS Studio check the log for ERRORs and WARNINGs by themselves, alerting you with a small red x or a yellow exclamation mark.

 

Inspecting the log and making sense of it (for all other NOTEs and messages) is still a job for us humans. Especially during development; once a job runs in production batch mode, checking the log automatically for certain phrases does make sense.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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