Viewing SAS macro variables in SAS Enterprise Guide
The SAS macro variable viewer is a tool that's part of SAS Enterprise Guide. You can use it to view the current values for all SAS macro variables that are defined within your SAS session. You can also evaluate "immediate" macro expressions in a convenient quick view window. If you develop or run SAS macro programs, this task can be a valuable debugging and learning tool. If you want to learn how to use the tool and see it in action, watch my SAS Tip tutorial on YouTube.
SAS Macro Variable viewer: features and function
This tool offers the following main features:
Always-visible window: Once you open the task from the Tools menu, you can leave it open for your entire SAS Enterprise Guide session. The window uses a "modeless" display, so you can still interact with other SAS Enterprise Guide features while the window is visible. This makes it easy to switch between SAS programs and other SAS Enterprise Guide windows and the macro variable viewer to see results.
Select active SAS server: If your SAS environment contains multiple SAS workspace connections, you can switch among the different servers to see macro values on multiple systems.
One-click refresh: Refresh the list of macro variables by clicking on the Refresh button in the toolbar.
View by scope or as a straight list: View the macro variables in their scope categories (for example, Global and Automatic) or as a straight list, sorted by variable name or current value. Click on the column headers to sort the list.
Filter results: Type a string of characters in the "Filter results" field, and the list of macro variable results will be instantly filtered to those that contain the sequence that you type. The filtered results will match on variable names as well as values, and the search is case-insensitive. This is a convenient way to narrow the list to just a few variables that you're interested in. To clear the filter, click on the X button next to the "Filter results" field, or "blank out" the text field.
Set window transparency: You can make the window appear "see-through" so that it doesn't completely obscure your other windows as you work with it.
Copy macro variables as %LET statements: Select one or more macro variables within the window, right-click and select Copy assignments. This generates a series of %LET statements -- one for each macro variable/value pair -- which you can then paste into a SAS program.
Macro expression "quick view": Have you ever wanted to test out a macro expression before using it in a longer program? This window allows you to get immediate feedback on a macro expression, whether a simple macro reference or a more complex expression with nested functions. If the expression generates a SAS warning or error, the feedback window shows that as well. Note: the expression can be any macro expression that is valid for the right-side of a macro variable assignment (%let statement).
Source code available on GitHub
I created this tool years ago as a custom task, but it's been included with SAS Enterprise Guide as an "official" tool for several releases. I built the task using the custom task APIs and Microsoft .NET. If you're interested, I've shared a version of the source code behind this task on GitHub.
The post Viewing SAS macro variables in SAS Enterprise Guide appeared first on The SAS Dummy.