BookmarkSubscribeRSS Feed
abdullala
Calcite | Level 5
weird thing: in a macro I had included several scripts using %include. in these scripts I had codes like %if - %then %do - %end. I got error message like:

ERROR: The %IF statement is not valid in open code.

I dont understand how this happened. all these %if stuff are still within the macro, right? Help appreciated!!!
2 REPLIES 2
Peter_C
Rhodochrosite | Level 12
that %include is passed through by the macro language compiler. The code is not opened and interpreted by that compiler, so %if is not valid once the syntax is out of the scope of the macro language compiler.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest the OP try some additional SAS OPTIONS settings (below) to diagnose further:

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MPRINT /* MLOGIC */;


Scott Barry
SBBWorks, Inc.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1445 views
  • 0 likes
  • 3 in conversation