Chapter Contents

Previous

Next
SAS Companion for the CMS Environment

Routing Messages to the SAS Log

A set of directives is available to SASMACRO programs to control printing to the SAS log. SASMACRO directives use a leading ++ sequence to differentiate them from normal SAS language statements. The directives must be specified in uppercase letters and cannot end in a semicolon. They must also be submitted on a separate line from other SAS statements.

Three directives are available for controlling printing to the SAS log:

' ++SASLOG'
causes subsequent SAS statements submitted from the SASMACRO to be printed in the SAS log.

' ++NOLOG'
causes subsequent SAS statements submitted from the SASMACRO not to be printed in the SAS log. This is the default setting.

' ++SASLOG message-text'
prints message-text in the SAS log and causes subsequent SAS statements that are submitted from the SASMACRO to be printed in the SAS log.

The following example uses the ++SASLOG directive to place text and subsequent SAS statements in the SAS log:

/* An extended version of TRYIT SASMACRO    */
   /* process arguments, establish defaults    */
parse arg dname argname .
if dname = '' then dname = 'a'
if argname = '' then argname = 'x'

   /* Place text into SAS log                  */
   /* and subsequent SAS statements            */
'++SASLOG Running the TRYIT macro.'

   /* Pass a DATA step and PROC step into SAS  */
'data' dname';' argname'=1; run;'
'proc contents; run;'

exit     /* Return to SAS                      */

SAS Log for TRYIT SASMACRO shows the resulting SAS log:

SAS Log for TRYIT SASMACRO
    
  1     tryit;
  ++++  Running the TRYIT macro.
  ++++  data a; x=1; run;
  NOTE: The data set WORK.A has 1 observations and 1 variables.
  ++++  proc contents; run;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.