BookmarkSubscribeRSS Feed
ChrisHemedinger
Community Manager

For this Juletip, let's unwrap a gift that you might have never found or perhaps forgot that you had: the SAS Macro Variable Viewer in SAS Enterprise Guide.

 

Ever wonder what’s happening behind the scenes with your macro variables? When your SAS programs rely on %LET statements, %SYSFUNC calls, or conditional logic, keeping track of macro values can feel like detective work. Fortunately, SAS Enterprise Guide has a built-in Macro Variable Viewer that makes this easy—and even fun.

 

SAS Macro Variable Viewer in EGSAS Macro Variable Viewer in EG


Why Use the Macro Variable Viewer?

The Macro Variable Viewer is your one-stop shop for inspecting and debugging macro variables without cluttering your log with %PUT statements. Here’s what it can do:

  • List all macro variables currently defined in your session.
  • Show values instantly—no extra code required.
  • Search by name to find what you need fast.
  • Evaluate macro expressions using the built-in Macro Expression Quick View.
  • Refresh as your program runs.

 

How to Access It

  1. In SAS Enterprise Guide, go to Tools → SAS Macro Variable Viewer.
  2. The viewer opens in a separate window, displaying all macro variables in your session. You can keep this window open while you continue to edit and run your SAS programs!

 

Quick Tips for Using It

  • Search for a Macro Variable
    Type part of the name in the search box—like _CLIENTAPP or MYVAR—and the list filters instantly.

  • Check Values Without Code
    Click any macro variable to see its value. No need for %PUT statements.

  • Evaluate Expressions
    Use the Macro Expression Quick View field and test macro functions and values on the fly:
%eval(5+3)


Or here's a more complext example, showing the date 3 weeks from today:

%sysfunc(intnx(week,"&sysdate9"d,3),date9.);


Wrap-Up

Use the Macro Variable Viewer to help debug your programs and check macro output. It saves time and helps you avoid surprises when your macro-driven logic depends on dynamic values.

 

Next time you’re troubleshooting a macro-heavy program, skip the guesswork. Open the Macro Variable Viewer and take control of your macro environment—fast, easy, and interactive.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!