Thursday, August 27, 2009

My SAS Macro Ran with ERRORs on iPhone. The Beauty of SAS Log

SAS macros are script files that execute SAS instructions similar to other SAS programs.  It is commonly used to automate tasks since the macros can perform repeated tasks with parameters that can be selected by the user.  On the iPhone, this can appear as a list screen with selection choices so the macro can be performed on the server from the selected values on the iPhone.  The SAS programmer that loads the macro on the server will configure the macros with different type of parameter selection type including the following examples:
  1. On Off Selector
    These are similar to check boxes where it can be set to on (checked) or off (unchecked).

  2. Short Text and Passwords
    The single text entry allows users to enter any text value to the entry.  A similar entry type is the password which will mask the entry so that the text is hidden.

  3. Check List
    This include a check list where the user can select one value from a list of valid values.

  4. Text Auto fill 
    This allows users to enter text but provides a list of valid values to choose from if what the user typed matches what is in the valid list of values.

  5. Date Time
    These are preset valid date and time selections.  This uses a spin controller with preset for date and time.

  6. Distinct Value Spin Control
    The spinner control can combine values from multiple data sources to then formulate one value.  The date and time above illustrates three spinners while this price range illustrates two.  You can have it show one to four spinner controls.

In the case of a macro, the parameters of the macro will correspond to a selection by one of the controllers above. The values of the controller are populated by values from a dataset stored on the server.

Macro Selection
The macros are stored in libraries which correspond to folders on the server.  If you have been granted permissions, you would be able to select the library and then view all the macros in the selected library. 


Each macro will have a macro short name which is also the name of the file on the server followed by a longer label.  The user can select it by selecting anywhere on the row corresponding to the macro.  If you wish to select macros from a different library, you can select the library displayed at the top.

Once you select the library, you can then return back to the Macros screen by selecting the "Macros" navigation button at the top.

Executing Macros
Once you have selected the macro, you will then be presented with all the parameter selection pertaining to the macro.  You can scroll down if this extends beyond one screen.   


Upon completion of selecting all parameters, you can then click on the "Run" button on the upper right.  This will enter all selected values and execute the macro.  If thee macro has an error, then the log is displayed.


If the macro runs successfully, then the results will be displayed.  Results can be in one of the standard SAS output format including: ASCII (LST), PDF, HTML, Excel (XLS), MSWord (DOC).  An example very simple SAS ASCII LST output is shown below.

No comments:

Post a Comment