Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Using Enterprise Guide®
Effectively
BI09-2012
Tom Miron
Systems Seminar Consultants, Madison, WI
Using Enterprise Guide Effectively
Enterprise Guide is not a fancy
program editor!
EG offers a new window onto the
power of SAS software
Using Enterprise Guide Effectively
Enterprise Guide requires a different
perspective on system design…
Visual coherence vs. tight coding
Using Enterprise Guide Effectively
We will discuss the use of the EG
environment and…
Features of Enterprise Guide that can
make your applications more user
friendly and maintainable
What Is Enterprise Guide?
Enterprise Guide is not SAS
Enterprise Guide is a user interface for
SAS
Enterprise Guide Generates
SAS Code
%_eg_conditional_dropds(WORK.SORTTempTableSorted);
/* -------------------------------------------------------------------
Sort data set LE5274.HIERARCHYMAPFROMTERESA
------------------------------------------------------------------- */
PROC SQL;
CREATE VIEW WORK.SORTTempTableSorted AS
SELECT *
FROM LE5274.HIERARCHYMAPFROMTERESA
;
Enterprise Guide Architecture
Client–Server architecture
EG is not running SAS or running as a
SAS application
A server somewhere on your network is
running SAS
Enterprise Guide Architecture
Your EG Session
SAS server 1 SAS server 2 SAS server 3
Data 1 Data 2
Enterprise Guide Architecture
EG generates SAS code and sends it
to a workspace server for execution
Results are returned to your EG
session
EG Servers List
Enterprise Guide Architecture
SAS servers are usually set up for you
by a SAS administrator
The SAS BI client-server architecture is
a deep subject!
Client-Server Considerations
The OS of your EG session may differ
from the server OS
Example:
EG on Windows
workspace server on UNIX
Client-Server Considerations
UNIX file names are case sensitive
Record/line termination differs
Line Termination on
Windows and UNIX
Windows = CR/LF
UNIX = LF
Use INFILE termstr= option
EG Projects vs SAS Programs
In Enterprise Guide you work with
“projects”
An EG project is a single file (.egp)
Enterprise Guide Tasks
EG projects are a collection of tasks
Most tasks map to a SAS Procedure
Tasks are grouped into “Process Flows”
Enterprise Guide Tasks
EG Task List Window
List Data Task Interface
List Data Generated Code
%TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(),
TIMEAMPM12.))";
PROC PRINT DATA=WORK.SORTTempTableSorted
OBS="Row number"
LABEL
;
VAR oldCat oldLine newCat newLine;
RUN;
/* -------------------------------------------------------------------
End of task code.
------------------------------------------------------------------- */
EG Tasks vs Program Code
The code you can write will always be
more compact and efficient than that
generated by EG.
It doesn’t matter.
EG Tasks vs Program Code
Life cycle efficiency is what matters
Life cycle efficiency is highly dependent
on:
- Development effort
- Maintenance effort
EG Tasks vs Program Code
Life cycle efficiency is usually not
dependent on:
- The number of statements executed
- Absolute machine efficiency
EG Tasks vs Program Code
It doesn’t matter if EG generated 100
statements where you could written a
10 statement SAS program because…
You don’t have to write any statements
The Temptation
Experienced SAS programmers are
often tempted to open a program object
and start coding
The Rule for Effective Use of EG
Avoid programs and custom code like
the plague
Why Not Program?
Programs and custom code introduce a
“black box” to your EG project
The “No Program” Advantage
EG tasks have a consistent interface
across all projects
EG tasks constrain the user/developer
to valid options and settings
EG tasks minimize spelling and naming
ambiguities
The Downside
The downside of EG tasks is that
standard tasks may not offer options or
processes you need
It’s tempting to turn to programs and
inserted code…but don’t
Inserted Code
The “No Program” Upside
To maintain a project with no custom
code you need to know EG
To maintain a project that does contain
custom code you need to know EG and
understand the SAS programming
The Answer to Task Limitations
More tasks…
You can almost always duplicate the
processing of a well coded SAS
procedure or DATA step with a series
of EG tasks.
Done In One DATA Step
EG Alternative
Three Query tasks (SQL)
“But wait…three passes of the data is
less efficient than one!”
EG Alternative
Development and maintenance time for
you vs.…
Machine resource time
Is The EG Way OK?
Are there practical execution time
constraints?
What’s the marginal cost of accessing
data?
EG Project Design
Tasks are grouped into process flows
All process flows together make up
your EG project
Process Flows
It’s tempting to put all tasks into a
single process flow…which leads to…
A visual mess
A project flow that’s hard to understand
A project that’s hard to maintain and
modify
Process Flows and Lots of ‘Em
One processing function = one process
flow
One table = one process flow
Process Flows and Lots of ‘Em
Don’t be afraid of multiple process
flows in your project
Grouping tasks into logical process
flows is one of the greatest benefits of
using EG…don’t limit yourself
Example Process Flows
Set SAS options
Establish SAS libraries or external file
FILEREFs
Import data from a spreadsheet or
database
Example Process Flows
Validate or clean data
Create a report
Export results to PDF’s or
spreadsheets
Benefits of Multiple PF’s
Each process flow workspace grid has
a minimal number of objects on it so it’s
easier to grasp what’s going on
The EG project is modular and can be
developed, tested, and run step-by-step
Benefits of Multiple PF’s
Using consistent, meaningful process
flow names the project tree acts as a
high level flow chart and helps minimize
written documentation
You can quickly navigate through a
complex project with the EG project
tree
Common Process Flows
Standardize common process flows
from project to project
Use consistent names and position in
the process flow sequence
Some Common
Process Flow Names
“Documentation”
“Start Up”
“Wrap Up”
“SAS Libraries”
“Utility”
Process Flows and Lots of ‘Em
One function/table = one process flow
means…
Modularity
Easier to understand
Easier to develop and test
Easier to maintain/modify
Many Tasks =
Many Intermediate Tables
When you avoid custom code you often
end up with many intermediate tables
Keep these tables in a permanent
library because…
You can restart in the middle
They’re useful for testing and debugging
Disk space is cheap
Many Tasks =
Many Intermediate Tables
Keep intermediate tables and final
output in separate folders/libraries…
Different sharing options
Different servers
Local or network
Use Note Objects To…
Document program objects (if you must)
Use Note Objects To…
Document process flows
Use Note Objects To…
Document your project in the
“Documentation” process flow
EG Backup
EG projects are stored as a single
binary file (not plain text)
Always back up the .egp file
Back up to plain text with “Export All
Code…”
Export All Code In Project
Wrap Up
Effective use of SAS Enterprise Guide
requires visual thinking rather than
thinking in terms of efficient SAS
statement coding
Wrap Up
A good EG project is organized around
a clear and logical visual display of
linked components that requires a
minimum of additional written
documentation
Wrap Up
Avoid the use of custom SAS code,
either as program objects or user
modifications of EG tasks
When you use custom code you
introduce a black box process that
doesn’t benefit from the the built-in task
dialogs or context Help
Wrap Up
Don’t be afraid of using multiple EG
tasks to accomplish something that
could be done is a single SAS step
Use intermediate result tables to stage
data through your project
Wrap Up
Use multiple process flows to break
your project into logical components
Use standard names for common
process flows (“Documentation”, “Start
Up”, etc.)
Wrap Up
Make use of Note objects linked to their
subjects to document specific
processes
Back up your project as both a .egp file
and as plain text SAS code
Contact Information
Name: Tom Miron
Enterprise: Systems Seminar Consultants
Address: 2997 Yarmouth Greenway Dr.
City, State ZIP: Madison, WI 53711
Work Phone: 608 625-4541
Fax:
E-mail: [email protected]
Web: sys-seminar.com
Twitter: