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.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 5029 views
  • 1 like
  • 4 in conversation