Traditionally, SAS users like their processes to behave like Ron Popeil's famous rotisserie: they want to set it and forget it. That's the definition of a batch process. You work like heck to get it ready to run, then you push the button (or schedule it) and walk away.
But sometimes SAS Enterprise Guide users want their processes to pause while running and wait for some input. It might be just a click to say "okay, keep running now", or it might be to ask a question of the end user. SAS Enterprise Guide has a built-in mechanism for adding prompts, but all of the prompts are gathered and displayed as soon as you begin to run the flow. There isn't a way to display an "in-your-face" message or to prompt at any arbitrary place in the process flow. (Long-time users will remember the %WINDOW macro feature in Base SAS, which can display a window when your program runs. Alas, %WINDOW cannot work with a remote SAS server.)
I built a custom task that allows you to add an interactive message or prompt step to a SAS Enterprise Guide process flow. Unlike a traditional project prompt, this task waits to display a prompt message until the process flow "run time" reaches the point of the Message Prompt task.
You can also tell the task to collect information through a simple prompt. For example: a Yes/No answer, a text value, or a password. In all, the Message Prompt task supports 4 styles of prompts:
- Information message prompt. Displays the text you define, and then continues when the user clicks OK.
- Yes/No question prompt. Displays the text of a question you define and provides Yes/No answer buttons. The response value (YES or NO) is stored in a macro variable named &_MESSAGE_RESULT.
- Text question prompt. Displays the text of a question you define and provides a text field for the user to enter a response. The response is stored in a macro variable named &_PROMPT_VALUE.
- Password question prompt. Displays the text of a question you define and provides a password-style text field for the user to enter a response. The response is stored in a macro variable named &_PASSWORD_VALUE.
Defining Dependencies (or "Run Order")
In order for the task to run and "interrupt" your process flow at precisely the right moment, you must create user-defined links in the flow. These links will establish proper dependencies that ensure that the task runs (and the prompt is displayed) after any prerequisite tasks but before any tasks that need to wait until after the prompt is addressed.
Working with the Task Results
Except for the "Information message" prompt, all prompting styles of the Message Prompt task will yield one or more results that are stored within SAS macro values. The user response (YES/NO/OK/CANCEL) is stored in _MESSAGE_RESULT. The text prompt value is stored in _PROMPT_VALUE or _PASSWORD_VALUE, depending on the style of text prompt that you selected.
You can use these macro variables in subsequent programs or tasks to react accordingly to the user response. You can reference the macro variables in custom programs, and you can also use the macro variables as input to Conditions that you define on tasks within a process flow. (See the SAS Enterprise Guide help documentation for more information about Conditions.)
The Message Prompt task also creates a simple log output that summarizes the task action and the user-supplied values. (In the case of the password prompt, the text value is obscured in the log.)
Using this Task in Scheduled Projects
You should avoid using this task within projects or process flows that you intend to schedule to run unattended. Scheduled projects are run by using the SAS Enterprise Guide automation API, and use of the Message Prompt task in automation will stop the project from running until the prompt is answered.
Download the task
The task is compatible with:
- SAS Enterprise Guide 4.3, 5.1, 6.1 (Windows 32-bit or 64-bit) or later
- SAS 9.2 or later (local install or remote SAS Workspace)
(Remember, you might need these unblocking instructions if using version 5.1 or later.)