SAS Enterprise Guide tools for programmers

0

If you are a SAS programmer, you may wonder why you should read this. After all isn’t SAS Enterprise Guide just for folks who don’t want to be bothered writing SAS code? SAS Enterprise Guide is just point, click, and get results, right? Well there is a lot more to SAS Enterprise Guide than just point-and-click!
SAS Enterprise Guide runs in the Microsoft Windows operating environment, and comes with Base SAS. It needs access to Base SAS either on your local computer, or on another computer. You write code or use tasks in your SAS Enterprise Guide session, submit your work to the SAS server, and the results are returned to your session. SAS Enterprise Guide organizes your work into projects which contain all your programs, tasks, shortcuts to data, and results in one place. Projects alone may be a reason to start using Enterprise Guide as your programming interface, but it has other great tools for programmers.

Here is a screen shot of a SAS Enterprise Guide session with an empty Program window open in the workspace. The Program window does not open automatically, but it is easy to either open existing SAS programs or write new programs in the Program window.

SAS Enterprise Guide tools for programmers

As with the SAS windowing environment (aka Display Manager), the program editor in SAS Enterprise Guide is syntax sensitive. This means that keywords, comments, quoted strings and the like, are all color coded. But the editor in SAS Enterprise Guide also gives you syntax help. As you type your program, syntax suggestions will appear in a pop-up list. You can continue typing, or choose the suggested keyword from the list. Additionally, if you hover over the keyword, a help window will appear that gives the syntax and a brief description of the keyword. In this window, you can see that the letters “LIB” have been typed into the editor and the keyword LIBNAME appears in the pop-up list. Hovering over the LIBNAME keyword makes the help window for the LIBNAME statement appear in the pop-up help window.

If you would prefer not to have this help, then don’t worry, you can easily turn these features off in the Options window.

We all know it is good practice to write SAS programs in a neat and organized manner. This makes it easier to read and understand our programs. But it is one thing to know it is good practice and another thing to implement it. Here comes SAS Enterprise Guide to the rescue! With just one right-click of the mouse, you can turn those messy programs into beautiful code by choosing “Format Code” from the pop-up menu. This screen shot shows the “before” view of a program. Notice that there is no indention and some lines contain multiple SAS statements.

Here is the “after” view of the program. Wow, what a difference right? But if you decide you really like the program the way it was, you can always click the Undo button. Also, through options, you have control over how much things are indented, and where to add blank lines if you don’t like the default settings.

When you run a program, you will get a flow diagram in the Process Flow that shows what data sets and reports are created by the program. Here you can see that the program creates two data sets and one report. But this view does not tell you much about what goes on inside the program. How many DATA steps does it have, and which SAS procedures are used?

Using the Analyze Program feature of SAS Enterprise Guide, you can get even more detail in your Process Flow. Choosing “Analyze for Program Flow” will open an Analyze SAS Program window where you can run and analyze your program and create a new process flow.

Here is what the process flow looks like for the program after analysis. Now you can see that the program uses the Olympics data set in a DATA step that creates two SAS data sets. Then the Winners data set is used as input to both a PROC MEANS and a PROC SGPLOT.

The program is also broken up into separate parts. So if you double-click on the icon for PROC MEANS, for example, only the code for that procedure will open in the program editor. Note though that this is a copy of the original program. So any changes that you make to code in this new process flow will not be reflected in the original program.

In addition to features that help you write programs, SAS Enterprise Guide includes ways to navigate directly to errors, warnings, and notes in your SAS log. You might also decide that it’s kind of nice sometimes to let SAS Enterprise Guide write code for you. Tasks in SAS Enterprise guide are a way to use point-and-click methods to get results and these tasks write SAS code. You can save the code that SAS Enterprise generates and make your own edits if desired. Susan Slaughter and I recently updated The Little SAS Enterprise Guide Book which covers all the basics of using SAS Enterprise Guide and has a chapter devoted to programming. With all of these features for SAS programmers, it is time to consider using SAS Enterprise Guide as your programming interface.

Share

About Author

Lora D. Delwiche

Author

Lora D. Delwiche (right) enjoys teaching people about SAS software and likes solving challenging problems using SAS. She has spent most of her career at the University of California, Davis, using SAS in support of teaching and research. She is also a one of the authors of Exercises and Projects for The Little SAS Book Fifth Edition.

Leave A Reply

Back to Top