4

I'm trying to use SAS macro language on my company's SAS Server. The rest of the (SAS-base) code works fine, but macros don't. Even a simple %let causes an error (this is the first line in the program):

5789  %let pgm = XXX ;
      -
      180
ERROR 180-322: Statement is not valid or it is used out of proper order

I have checked the system options under tools and the 'macro' option is set to 1.

Anybody know how to get macros working properly?

Thanks :)

ajl4j
  • 41
  • 1
  • 3
  • is there any code proceeding this statement? What version of SAS? – DomPazz May 20 '15 at 23:21
  • Hmmm the log says it is the 5789th line of the program. :) if you start a new session can you repeat the problem? Did you try batch submitting the program? Try adding options macro; Perhaps run proc options to confirm that the macro option is on. Looks like that has to be set during SAS invocation. (Even macro haters usually don't turn it off, so I'd be surprised if someone intentionally turned it off). – Quentin May 21 '15 at 00:32

1 Answers1

2

I would check the macro option by running proc options:

proc options option=macro;
run;

The macro option needs to be set during SAS invocation. So you may need to check the config file used by your SAS session. In server SAS, could mean talking with your SAS admin as there may be a plethora of config files for different logical servers....

I was able to replicate your results in PC SAS by specifying -nomacro during invocation. I've known plenty of people who hate the macro language, but never so much that they actually turn it off. My log after turning off the macro language is:

1    proc options option=macro;
2    run;

    SAS (r) Proprietary Software Release 9.3  TS1M2

 NOMACRO           Do not allow use of SAS macro facility

3
4    %let x=1;
     -
     180

ERROR 180-322: Statement is not valid or it is used out of proper order.
Quentin
  • 5,960
  • 1
  • 13
  • 21
  • 2
    Wow, didn't know you could turn the macro language off. – Stig Eide May 21 '15 at 07:00
  • Thanks, I forgot there was a proc options. Here is what I got: "13062 proc options value option=macro; 13063 run ; SAS (r) Proprietary Software Release 9.4 TS1M2 Option Value Information For SAS Option MACRO Value: MACRO Scope: Default How option value set: Shipped Default " ....so it sounds like macro option is turned on, at least. – ajl4j May 22 '15 at 01:22