Using SAS Enterprise Guide effectively

Chris Hemedinger is not the only person who’s excited about the capabilities of SAS Enterprise Guide. Tom Miron, from Systems Seminar Consultants, a SAS author with more than 35 years of SAS experience, shared some great advice for using SAS Enterprise Guide.

“The first thing I want to emphasis to you … is that Enterprise Guide is not a fancy program editor. A lot of times, Enterprise Guide will be plopped on [your]computer desktop and – you’re experienced SAS programmers and say, ‘OK, I can’t use SAS Display Manager, so I’ll use Enterprise Guide – it’s got a pretty cool program editor,’” began Miron. “It’s much more than that; it really gives us the opportunity to change the way we view – especially large and complex – projects.”

Miron says to step back and take a new view of your project to see if it has visual coherence. It really doesn’t matter if the underlying code is neat and clean. This may be the hardest concept for advanced programmers because it isn’t intuitive – it’s antithetical to all that you’ve been taught about programming.

Weighing the cost

According to Miron, SAS programmers often strive to write the tightest, most elegant code that executes as quickly as possible with the fewest statements possible. “Code that you write will almost always be more compact and efficient than that generated by SAS Enterprise Guide; that doesn’t matter because you didn’t have to write the code or debug it,” he said. “Typically this extra code doesn’t impact the real life performance of the task. It’s ok to run this extra code [generated by Enterprise Guide]because lifecycle efficiency is usually not dependent upon the number of statements executed or the absolute machine efficiency.”

The lifecycle cost considers the time it costs to execute your program – does it run daily, monthly, yearly – against the cost of coding and debugging. It also considers development and maintenance costs for your system as well as costs to update and modify the system. When the system is updated, what is the cost to update your programs? The lifecycle costs are really the sum of these. Hand coding may reduce costs on execution sometimes, but the tradeoff is usually in favor of Enterprise Guide.

Pretty and understandable

Another distinction from SAS is that you work in projects - a series of tasks, which typically map to SAS procedures (when run, they generate PROC code). “SAS Enterprise Guide allows you to assemble graphical objects that represent data processing tasks. Those tasks, connected in a chain, usually create data objects such SAS tables, spreadsheets and reports. These chains of tasks and data are grouped into process flows. The process flows are stored as a SAS Enterprise Guide project.”

Programming and custom code are the plague

“As soon as you add custom code to SAS Enterprise Guide, you’ve added a black box where there is no self-documenting,” said Miron. “Now, no longer can someone else follow your steps.”

Another thing programmers are tempted to do is insert code – this holds the same danger as custom code. The next person who has to maintain your Enterprise Guide project cannot see the inserted code.

Upside

Consistent interface across projects.

Constrain the user to valid options and settings.

Minimizes spelling and naming ambiguities.

Self-documenting.

Downside

Some things that you need or want are not available in the task menu.

Inserted or hand coding is not auto-documented – it’s black box to other users.

Those who maintain projects with inserted or custom code must understand both Enterprise Guide and SAS.

Miron said that hand coding might mean one pass, while Enterprise Guide may take multiple queries. Most often, the multiple queries are still more efficient because there is no black box code left behind. Always remember that this is not a hard and fast rule and should be applied on a case-by-case basis while considering the tradeoffs.

Manage the flow

“Don’t be afraid of multiple process flows in your project – in fact, use lots of process flows,” Miron said. “It’s a built-in benefit of Enterprise Guide.”

Examples of process flows:

Validating or cleaning data

Creating a report

Exporting results to PDF’s or spreadsheets

Benefits of process flows

The workspace really gets cleaned up because there are minimal objects.

Use of consistent names will reduce the written documentation.

You can quickly navigate a complex project.

You can use common process flows from project to project.

Miron gave a couple of example process flow names that he sometimes uses: Changes (including history of the project), Start up, Wrap up, SAS libraries, Utility and Junk drawer. “You cannot conditionally - at least not in SAS Enterprise Guide 4.3 - apply an execution condition test to a process flow. You can only do this with a task node. (That would be a great idea for the SASware Ballot I guess.)”

Miron covered far more SAS Enterprise Guide best practices than I can ever cover in a short blog post. Besides, I have to leave some suspense that will ensure that you read his paper.

Download Miron’s paper, Using Enterprise Guide® Effectively, and all of the MWSUG 2012 proceedings, now!!

Using SAS Enterprise Guide effectively was published on SAS Users.