Saturday, July 11, 2009

SAS Macro on the iPhone

In the traditional batch environment, users specify the options for a macro by typing the selected values in a SAS program script when invoking a macro. The entered values would then be processed by the macro by inserting them into the specified parameter in the code. An example macro call is:

*** Generate Report of data by specific subset ***;
%dataview (indata=mylib.demog,
sortby = subjid startdt,
reptitle = Demographic data sorted by subject ID and start date);

In this example, there are three parameters including: INDATA, SORTBY, and REPTITLE. The iPhone application makes this more user friendly as compared to having the user write a SAS macro call. In this case, the iPhone user selects the values from a macro parameter through the multi touch interface of the iPhone user interface. The user would therefore access and execute the %dataview macro by performing the following steps.

Step 1 – Selecting Macro

The user would navigate to the macro section by tapping on the macro button on the navigational bar at the bottom. This brings the user to a list of all the SAS program macros that the user has privileges to in the current library.

The user can navigate through different libraries by taping on the library choice as shown in the current “PGMDAT” example. In this example, they would tap on the “%DATAVIEW Macro” to drill down to its parameters.

Step 2 – Selecting Macro Parameters
Upon the selection of the %datataview macro, all the macro parameters will be presented with standard iPhone user interface elements. Each parameter will be listed as in the order in which it is defined.

In the traditional macro approach, the user would input the values of the parameter by typing the text inside a SAS script according to the named parameters. This is difficult for users when they are not familiar with the macro or associated data. This commonly leads to erroneous entries and errors in the macro execution. The iPhone interface is much more user friendly. In this example, three distinct entry types are displayed.

  1. Input Data – The input data parameter uses a standard SAS two level dot notation which is LIBNAME.DATASET. In this example, it is “mylib.demog” which refers to a library “MYLIB” and the dataset DEMOG. The user can edit this as open text or in addition, there is the option of drilling down to a list for the selection of libraries and datasets in selection.

  2. Sort Variables – The sort variables is a standard multiple option selection list. There are several different type of selection list. In this case, a simplified multiple selection list is presented as an example.

  3. Report Title – The report title requires a standard text entry field which the user can type any text value with the aid of an onscreen keyboard.

There are many other types of controllers which parameters can be configured to make the user entry more intuitive. Keep in mind that the user is using their index finger or thumb on a multi-touch screen. This is very different than a pointer device such as a mouse on a large desktop monitor. These other example selection options illustrates how the iPhone interface can optimize to allow users to select their parameters effectively from a mobile device.

  1. Check List

  2. Spin Controller

Some of the graphical user interface elements are similar to those found on desktop windows applications. The text entry and check list is similar to a text entry or list box on desktop applications. They only differ in their layout so it is easy for users to tap with their fingers. However, some user interface elements diverge from the desktop interface to fully take advantage of the mutli-touch smaller screen of an iPhone. This is particularly apparent in the spinning control which looks very different compared to any controller on a desktop application. The author of the macro would configure their macros and select which controller is best suited for each parameter. Default list of values will be displayed based on values of a dataset or the SAS system views such as SASHELP.VSLIB for list of available libraries. Once the macro authors configures this on the server, the user can benefit from having a user friendly method of selecting and executing the macros.

No comments:

Post a Comment