Home » Stored Processes

SAS EG and Stored Processes: 3 Tips for Using Options

Submitted by on February 20, 2012 – 6:30 am 2 Comments

There are some helpful options you can set in SAS Enterprise Guide to make your day-to-day coding tasks a little quicker. Some of these tasks can impact stored processes you create from tasks instead of coding.

SAS Enterprise Guide Options

From the Tools > Options menu you can preset options such as footer text and default SAS code that you want run before or after a task executes. Sometimes this can be more helpful than other times.

Tip #1 – Adding a Default Footer

You can add a default footer or header to all of your SAS generated reports. If you are using the SAS Tasks, SAS automatically adds whatever you have preset in the Options.  If you use SAS functions or macro variables your reports and graphs will appear more customized.

To set  a default footer for your SAS Enterprise Guide reports and graphs, do this:

  1. From the Tools>Options menu, select the Tasks General pane.
  2. In the Default footnote text for task output field, type your text.  For instance, I am using the default time and date to indicate the last time the report was updated.  
    Note! The date() function returns when the SAS Enterprise Guide session was started not the system time. Only causes a problem if you never log out of your SAS EG session.

Tip #2- Adding Code to Run before Each Task

You can add custom code to run before or after a task or a query.  For instance, maybe you always want the output to be justified to the left.  You would add the options nocenter; text.  If SAS Enterprise Guide has an annoying behavior, sometimes you can control the options through this setting.   

  1. From the Tool > Options menu, select Custom Code pane.  
  2. Click the Edit button to type your custom code into the Edit window.   
  3. Click the Save button when complete.

Tip #3 – Changing a Task to Stored Process

 Now for the gotcha, if you are creating a stored process from a task flow instead of coding it, these options are added to the code. So you may have to temporarily disable the options if you do not want the stored process to have the behavior.  In the following figure, you can see the log output with my custom code and footnote.

 

This does not hurt anything if it matches your intent for the stored processes.  If it’s not what you want then you can either disable the option before creating the stored process or manually edit the stored process code.

 


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!

 

The following two tabs change content below.
Tricia Aanderud is a SAS Business Intelligence and Visual Analytics consultant based in Raleigh, NC. She has written several books about SAS, presented papers at many SAS conferences, and has over 10 years of SAS programming experience. Contact her for assistance with your next project.

Tags: ,

2 Comments »

  • I’m not sure … I know you can add OPTIONS NOCENTER; to get left aligned but I don’t know about right aligned. Anyone?

  • Harsh Gajjar says:

    Nice One.. But in case of Stored Process Is it possible that we can have certain objects like graphs left aligned and reports or tables right aligned.. in the default ods.