Case Study: Migrating an Existing SAS® Process to Run on the SAS

advertisement
Creating and Using Prompts in SAS®
Enterprise Guide
Joseph Urbi, WellPoint, Virginia Beach, VA
Background
• Prompts help you create flexible and reusable SAS Enterprise
Guide projects
• Can drive query generation, guide a user through what-if
analyses, or customize output content
• A prompt is basically a means to capture an answer to a
specific question and store it as a macro variable that is used
within the EG project
• Can be as simple as a text box that the user types a single
value into or as complex as a multi-value dynamic list that is
dependent on another prompt
Prompt Types
Text / Text Range
Data Source / Data Source Item
Numeric / Numeric Range
File or Directory
Date / Date Range
Color
Time / Time Range
Data Library
Timestamp / Timestamp Range
Hyperlink
Dynamic List – multiple values
Variable
Prompt Dialog Box
Using Prompts in
Programs
Prompts in Programs
Prompts in Programs
Prompts in Programs
We want separate
prompts for Month
and Year
Prompts in Programs
Open the Prompt
Manager and
press Add
Prompts in Programs
Prompts in Programs
Prompts in Programs
Prompts in Programs
Press Add to create
a new list member
Prompts in Programs
Prompts in Programs
Prompts in Programs
Now we want to associate
our Month and Year
prompts with the program
Prompts in Programs
Prompts in Programs
Prompts in Programs
Press Add and
associate both
prompts with the
program
Prompts in Programs
Prompts in Programs
Press Run to see the
prompt
Prompts in Programs
Using Prompts In
Queries
Prompts in Queries
Prompts in Queries
Prompts in Queries
We need to create the
prompt before we can use
in a filter
Prompts in Queries
Press Add and create a
prompt for County.
Once done, return to
the Query Builder
dialog
Prompts in Queries
Now we can create
the filter
Prompts in Queries
Prompts in Queries
Prompts in Queries
_eg_WhereParam is a custom SAS macro used to
facilitate prompts in filters
Prompts in Queries
Prompts in Queries
Prompts in Queries
Prompts in Queries
Prompts in Queries
Things To Consider
• You can’t really control the look and feel of the prompts and
the prompt dialog
• Basic value checking is possible, but you can’t do complex
validation
• For many prompt types, multiple macro variables are
generated. For example, a numeric range prompt called pNum
will create two macro variables called pNum_MIN and
pNum_MAX
• You can create shared prompts that can be used in more than
one EG project
Recommended Reading
• Hall, Angela. 2011. “Creating Reusable Programs by Using
SAS Enterprise Guide Prompt Manager” Proceedings of the
SAS Global Forum 2011 Conference. Cary, NC: SAS Institute
Inc.
• Sucher, Kenneth. 2010. “Interactive and Efficient Macro
Programming with Prompts in SAS Enterprise Guide 4.2”
Proceedings of the SAS Global Forum 2010 Conference. Cary,
NC: SAS Institute Inc.
Download