DATA Step, Macro, Functions and more

do NOT resolve this macro!

Posts: 39

do NOT resolve this macro!

I am using SAS to write SAS code to a external dataset, which will later be brougt in by using a %include.

The SAS code being written contains macro calls.

I was very surprised to find that SAS was trying to resolve the macro call as I was writing it to the external file.  Obviously not the ime I want this to occur.

How do I prevent SAS from trying to resolve these macro calls while I am writing the code to the external file?

SAS Employee
Posts: 104

Re: do NOT resolve this macro!

Could you post a sample of the code that's giving you problems?  This code writes SAS macro code to an external text file, and doesn't resolve until the later %INCLUDE.

data _null_;
   file 'test.txt';
   put '%PUT NOTE: The date is %sysfunc(today(),mmddyy10.);';
/* Open and read the text file - the macro code is not yet resolved... */

%include 'test.txt';
Super User
Posts: 9,691

do NOT resolve this macro!

Or You can turn Macro language off before starting SAS by using

options nomacro;

SAS option MACRO is valid only at startup of the SAS System or startup of a SAS

               process. The SAS option is ignored.

Another way is to use macro quote functions to mask these maro variables.


Super User
Posts: 10,550

Re: do NOT resolve this macro!

You don't say how you are writing the text file. If using PUT statements I would suspect something that should be quoted isn't. The other is the difference between "%somemacrotext" and '%somemacrotext' where the first will attempt to resolve and the second doesn't.

Posts: 35

do NOT resolve this macro!

This certainly helped my case Smiley Happy

Ask a Question
Discussion stats
  • 4 replies
  • 1 like
  • 5 in conversation