BookmarkSubscribeRSS Feed
LeonidBatkhan
Lapis Lazuli | Level 10

Everybody is familiar with SAS global statements, such as

  • FILENAME statementmanaging-global-statements.jpg
  • LIBNAME statement
  • OPTIONS statement
  • TITLE statement
  • FOOTNOTE statement
  • X statement, etc.

They can be used in SAS open code, within SAS macros, as well as within DATA and PROC steps.

Global statements are not executable by definition, meaning they are not executed during individual iterations of the DATA step. However, they do "take effect", that is in essence "execute" at some point in a SAS program. To lift the veil of mystery about SAS global statements' habits I recently wrote a blog post

How to conditionally execute SAS global statements

Take a read and you will never be confused by the global statements' behavior again.

Happy programming,

Leonid 

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

I would title this thread "How to: Conditionally execute SAS global statements"

to carry the fact that this is not a question.

LeonidBatkhan
Lapis Lazuli | Level 10

Hi ChrisNZ,

That is how the blog post is titled. As for the Community "announcement" title, there are two attributes which make it non-question: 1) no "?" at the end, and 2) "can" stands after "you", in a question it would've been in reverse 😀

ChrisNZ
Tourmaline | Level 20

More emphasis on the demonstration rather than question aspect can only be a good thing imho, but your call obviously, just a suggestion 🙂 

LeonidBatkhan
Lapis Lazuli | Level 10

Hi ChrisNZ,

Per your advice, I modified the title to be "Solution: How you can conditionally execute SAS global statements".

Thank you,

Leonid

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1295 views
  • 8 likes
  • 2 in conversation