Prompt Framework: SAS Shared Prompts are Scrumpdillyicious!
When I was growing up, a big treat on a Sunday summer afternoon was to drive into town and get a Dairy Queen ice cream cone dipped in chocolate. Dairy Queen advertised their treats as scrumpdillyicious, which they were to a seven-year old! If you are not aware, SAS ships some shared prompts that you can use with your stored process … and you guessed it … I think they are scrumpdillyicious!
Locating the Shared Prompts
SAS ships about 15 shared prompts that you can integrate into your stored process. These prompts are typically found in this location:
SAS Folders > Products > SAS Intelligence Platform > Samples
The shared prompts allow you to select styles, logs, packages, and so on. Many of the tasks you may routinely need when creating a stored process. [Contact your SAS Administrator if you cannot find the samples.]
Working With an Example
From the stored process I created in the Using Alternating Background Color with PROC REPORT post, how about we allow the users to select the style? We will just default to a gray (#F0F0F0) as the alternating color for the row.
Step 1: Adding a Shared Prompt
If you are editing in SAS Enterprise Guide, you can find these sample prompts in the Prompts pane by clicking Sharing > Add Shared and then navigating to the location shown in the following graphic. For this example, I added: ODS Styles – Static and Show SAS Log.
However, notice there are two shared prompts available for styles:
- ODS Styles – Static Lists the styles shipped with the system.
- ODS Styles – Dynamic Lists the styles available from the system. If your organization often adds new styles then use this choice as it will give the most updated list.
In most cases, this Lists of Static styles prompt will work and its faster. The dynamic prompt has to generate the list of styles before supplying the prompt – so only use it if it’s really needed. After adding the ODS Style prompt, I add the Show SAS Log shared prompt to my list – as shown in the following figure.
Step 2: Updating the Code
Now how do we allow the user to select the style? Probably we need a huge amount of coding changes … so I hope you packed your lunch! I’m kidding – how about if we just delete the Let statement and let the shared prompt do the magic?
In the Before code, I had manually set the _ODSSTYLE value. (i.e. Journal) In the After code, delete the %LET statement. The ODS Style prompt passes the reserved macro variable to %STPBEGIN, which sets it. I did add another Title statement just to capture the style name.
No changes are needed for the Show SAS Log prompt.
Reviewing the Results
When I run the results in the SAS Stored Processes Web Application – these are the results. Notice that the SAS Log appears after the results.
In the 50 Keys to Learning SAS Stored Processes book, there are many examples of using prompts including the SAS-supplied prompts. Hope you enjoyed this delicious treat – have you used the SAS shared prompts for any special projects?
Learn More about SAS Stored Processes and Prompts
You can learn more tips and tricks for creating, debugging, and using SAS stored processes in the 50 Keys to Learning SAS Stored Processes book. It's a complete guide to SAS stored processes. Check Amazon for best pricing and quick shipping!
Latest posts by Tricia Aanderud (see all)
- Creating a Web Analytics Report in SAS Visual Analytics 8.1 - 2017-06-19
- Designing Dashboards: Sending Your Style Vibe - 2017-01-21
- SAS Visual Analytics: Design Versus Reality - 2016-10-05
- Seize the Day! Submit an #SASGF Abstract - 2016-09-21
- Need a Dynamic X-Axis with Your SAS Visual Analytics Report? - 2016-07-31