Dynamically changing the style for stored process output in SAS® Enterprise Guide®


Overview

The default style for stored process output is specified by the _ODSSTYLE macro variable, which is set to the default style that is currently selected for the client. Because each user might prefer to use a different style for stored process output, this KB article explains how to use SAS Enterprise Guide to create a stored process that enables users to override the default set by _ODSSTYLE.

Create a Macro Variable for the Style

1. Select File ► New ► Stored Process.

2. Name your stored process, and then proceed to page 2, which is the SAS Code page.

3. On this page, enter the following code, which executes a simple PROC PRINT and uses the ODS style macro. This code creates a macro variable named STYLE that contains the value of the style that the user selects. For the style to override the existing one, you must also set _ODSSTYLESHEET to blank:

  /* Set ODS STYLE */

%let _ODSSTYLE=&style;
%let _ODSSTYLESHEET= ; 

%stpbegin;

/* Print DATA set */
proc print data=SASHELP.CLASS; run;

%stpend; 

4. Select only Global macro variables for the Include code for option at the bottom of the window. The %STPBEGIN and %STPEND macros were added manually so that the %LET statement used for _ODSSTYLE could be positioned outside of those macros.

Create the Prompt for Style

1. Click Next until you reach page 4 of the wizard, the Prompts page.

2. On this page, select New ► Prompt from SAS Code, and then select Style.

3. When the Edit Prompt dialog box opens, click the Prompt Type and Values tab.

4. Select the Prompt type and Method for populating prompt as shown in the following image:

5. Click the Get Values button to retrieve the values for the different styles from the source data set.

6. In the Get Values dialog box, browse in the SAS Folder location to the Samples folder, as shown in the following image and select ODSSTYLE:

7. For the Column option, select display. In the Available Values box, click Get Values, and then move all of the styles over to the Selected Values box:

8. Click OK to return to the Prompt Type and Values tab.

9. Select Banker as the default from the List of values.

10. Click OK and then Finish in the wizard.

Test the Stored Process

In the process flow, right-click the stored process and select Run. You are prompted to choose the style that you'd like to use, as shown in the following image:

Tip: This stored process can also be run in the SAS® Add-In for Microsoft Office.

Additional Documentation

For more information about using SAS Enterprise Guide, see the SAS Enterprise Guide documentation page.

For more information about using the SAS Add-In for Microsoft Office, see the SAS Add-In for Microsoft Office documentation page.

For more information about stored processes, see SAS 9.2 Stored Processes: Developer's Guide.

 


These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.