SAS Script Recording

I am developing a lot of Java, PHP and Python. All of them offer large logging packages (Log4J, Log or logging respectively). This helps a lot when debugging applications. Especially if the application works without heads.

Now I have a SAS script that should run as a stored process. But for some reason, execution seems to be very slow once it starts as a stored process. I would like to make some notes to find out what the application does. And when he does it. Therefore, I can pinpoint the code that causes slow execution.

I was looking for some solution to register with SAS, but haven’t found anything yet. Can i use something? Adding to a text file would be a good start. But logging into the Windows event log or the remote syslog service would be even better.

+3
source share
3 answers

There is an ntlog function that can write to the Windows event log. This is described on this page .

+3
source

Another possibility would be to redirect the log to a file. Example:

%let logPath = d:\sas.log;

/* Delete the old log */

data _null_;
    logFile = "mylog";
    rc = filename(logFile,"&logPath");
    if rc = 0 and fexist(logFile) then
       rc = fdelete(logFile);
    rc = filename(logFile);
run;

option nonotes nosource;

/* Redirect log to file */

proc printto log = "&logPath";
run;

%put >> File logging started <<;

%put ERROR: An error occured (macro);
%put WARNING: A warning occured (macro);

data _null_;
  put "ERROR: An error occured inside my data step";
run;

%put >> File logging ended <<;

/* Turn standard logging on again */

proc printto; 
run;

option notes source;

%put NOTE: Back to session log;
+3
source

A quick search on support.sas.com gave me this link.

Usage Note 34114: Creating a SAS® Detailed Store Log by Default Stored Process

http://support.sas.com/kb/34/114.html

+2
source

Source: https://habr.com/ru/post/1722552/


All Articles