Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

Using the SAS Code Analyser Procedure

A very useful feature available in SAS9.2 and later is the SCAPROC procedure, which captures information about inputs and outputs to a separate log file whilst a SAS job is running.  The main advantage over the standard SAS log, is that the SCAPROC log documents input and output files more thoroughly and includes options to list variable attributes, together with the exact times at which individual files have been accessed.  The procedure can be triggered in interactive or batch mode.

If submitting code from the editor window, the syntax for the procedure is as follows:

proc scaproc;
record “c:mylogsprog1.log” ;
run;

program code;
…;
…;

proc scaproc;
     write;
run;

Alternatively, by using the –INITSTMT and –TERMSTMT options, SCAPROC can be invoked on the command line used to start SAS or run a batch job:

"C:Program FilesSASSASFoundation9.2sas.exe"   
-INITSTMT "proc scaproc; record 'c:mylogsscaproc.log'; run;“
–TERMSTMT “proc scaproc; write; run;”

The following screenshot shows part of an SCAPROC log file:

Using the SAS Code Analyser Procedure Image 1

The SCAPROC log is comprehensive in the reporting of input and output items, which include the following:

Input and Output data sets from DATA steps and Procedures (including GLM whose input data set is not reported in the standard log).

  • Files defined via: INFILE, FILE, FILENAME statements, PATHNAME function, Macro variables, %INCLUDE code, FILENAME PIPE statements.
  • ODS destinations that have been defined via: PATH=, BODY=, FILE=, GPATH=
  • Catalogue entries including: Formats, Informats, GRSEG entries.
  • Item Stores.

All of the above information can be extracted by using DATA steps with appropriate search and string handling functions, in order to list the inputs and outputs within a group of programs.