Creating Effective Graphical User Interfaces Using Version 8 SAS/AF® Anders Longthorne, National Highway Traffic Safety Administration, Washington, DC

Creating Effective Graphical User Interfaces Using Version 8 SAS/AF® Anders Longthorne, National Highway Traffic Safety Administration, Washington, DC

NESUG 16 Posters PS001 Creating Effective Graphical User Interfaces Using Version 8 SAS/AF® Anders Longthorne, National Highway Traffic Safety Administration, Washington, DC ABSTRACT Improving access to an organization’s database can often result in large gains in productivity and therefore lead to improved response time to customers. This paper will show how this goal can be achieved using applications developed with SAS/AF software. Applications implemented using SAS/AF can be used by all workers within an organization, including those who do not have SAS® programming experience. INTRODUCTION SAS/AF software provides a set of tools that allows for the development of powerful interactive and intuitive applications. The ability to produce applications of this kind can quickly help an organization to improve its productivity and therefore its response time to customers. A developer must have SAS/AF software licensed on his computer in order to start developing the type of applications that will be discussed in this paper. To run SAS/AF applications only requires a licensed copy of Base SAS. There have been many books and papers written on the subject of SAS/AF and therefore this paper will not concentrate on the technical details of SAS/AF. Instead this paper will give details regarding the steps needed to create a basic application. By learning how to create and manipulate a basic application, the door to using SAS/AF will be opened; and with further reading and practice a new user should be able to develop sophisticated solutions to an organization’s needs. This paper assumes that the reader has a good knowledge of Base SAS, the SAS Macro Language, the SAS Output Delivery System (ODS), and a basic understanding of object-oriented programming. SAS/AF OVERVIEW SAS/AF software is a type of software that is generally known as object-oriented. Visual Basic, C++ and Java are other types of object-oriented software. Creating applications using object-oriented software is known as object-oriented programming (OOP). The key concept behind OOP programming is that a program is viewed as a collection of independent objects, where the objects have two characteristics: state (data) and behavior (operations that can be performed on the data). SAS/AF objects store their state within their Attributes. Attributes are variables that can be of the following types: Numeric, Character, List, Array and Object. Methods are functions that are used to change an object’s state. For a more detailed discussion, please refer to the SAS documentation referenced at the end of this paper. CATALOGS SAS/AF applications are built around a SAS catalog. SAS catalogs are storage locations that are only usable by the SAS system. Catalog entries are stored within a SAS catalog. While there are many types of Catalog entries, this paper is going to concentrate on only two types: Frame entries and their related Screen Component Language (SCL) entries. Applications can be easily developed using just one catalog, however it is also possible to use multiple catalogs. FRAME ENTRY Frame entries are windows within which instances of visual classes (controls or components) are placed. This is where the Graphical User Interface (GUI) for an application is developed. The GUI is usually the only part of an application that an end user will interact with and therefore proper design of a GUI is essential. - 1 - NESUG 16 Posters SCL ENTRY SCL entries can either be stand-alone programs or they can be linked to a Frame entry. When linked to a Frame, SCL entries can be used to provide functionality to the visual components of the Frame. HOW TO DEVELOP A SAS/AF APPLICATION There are two ways to develop SAS/AF applications: using interactive development windows or using the Build Procedure. This paper will concentrate on using the interactive windows environment. CREATE A CATALOG 1. First create a new SAS library. 2. Enter the new library via the SAS Explorer window. 3. Select FILE -> NEW -> CATALOG 4. Name the new catalog and then click ok. CREATE A FRAME ENTRY AND ITS ASSOCIATED SCL ENTRY 1. Enter the new catalog via the SAS Explorer window. 2. Select FILE -> NEW -> FRAME 3. A new window will open on the right side of the screen and a third pane, called Components, will be added along side the SAS Explorer and SAS Results window. The new window is the Frame entry. 4. Select FILE -> SAVE AS. Enter a name for the new Frame and click save. 5. Select VIEW -> FRAME SCL. This will open the associated SCL entry for the new Frame. The SCL entry will have the same name as the new Frame but it will be of the SCL entry type. VISUAL COMPONENTS OVERVIEW The following table contains descriptions of some of the more generally useful visual components that are provided with SAS/AF. The visual components described in the table should provide enough functionality to allow a developer to produce effective applications. Visual Class Name Appearance Description Provides a switch for On/Off, True/False or Yes/No Check Box Control functionality. Provides a drop down list of items from which an end Combo Box Control user may select only one. Provides a list of items from which an end user may List Box Control scroll through and select one or more. Provides a push button that can be used to run a process Push Button Control or provide switch functionality that is similar to the Check Box Control. Provides mutually exclusive selection options, so that only one selection can be made at any time. Radio Box Control This Class is similar to the Combo Box Control except that all choices are visible. Text Entry Control Provides the end user an option to enter text. Provides a text label that is not editable by the end user. Text Label Entry These labels can be used to create page titles or to provide help and guidance to the end user. - 2 - NESUG 16 Posters DEVELOP A SIMPLE APPLICATION USING A RADIO BOX VISUAL COMPONENT 1. Have the Frame and Components Window open. 2. Click on the Radio Box Control in the components window. Be sure to select from the Components list and not from the Version 6 objects list. 3. A Radio Box Control should appear in the Frame. 4. Click on the Frame and then Select VIEW -> PROPERTIES WINDOW. The Properties dialog window should open. On the left side of the properties window will be an expandable menu for all of the objects currently on the Frame. Expand RadioBox1 to view all of the possible Attributes, Methods and Events for the Radio Box Control Object. RadioBox1 is the default name for the object. This name can be easily changed by setting the object’s name attribute. There are many other attributes divided into categories such as Appearance, Behavior, and Data etc. All the visual components described in the above table have very similar attribute lists associated with them. All of these attributes can be either interactively manipulated, using the mouse or keyboard via the properties window, or they can be manipulated from within an SCL program. To discuss and understand the full power of all of these attributes is beyond the scope of this paper. 5. In the properties window select ATTRIBUTES -> DATA. Open the list located in the VALUES column of the ITEMS ATTRIBUTE row. This is where a developer may enter data to be used as selections by an end user. Something similar to the following should be visible: - 3 - NESUG 16 Posters 6. Select Remove All. Use ADD to populate the list with data. This list now contains all possible selections to be displayed. Click OK and then close the properties window. - 4 - NESUG 16 Posters 7. Something similar to the following should be visible: 8. In a short time we have developed a very simple Graphical User Interface (GUI). To add functionality to this GUI we will now open the associated SCL entry. Click on the Frame. Select VIEW -> FRAME SCL. Something similar to the following should be visible: - 5 - NESUG 16 Posters 9. The SCL entry is where SCL code can be written to add functionality to the GUI. SCL is a fully developed and powerful programming language. A full discussion of SCL is beyond the scope of this paper. One very important feature of SCL programs is that they allow for the submission of SAS DATA STEP and SAS PROCEDURE statements to the SAS SYSTEM. This allows SAS/AF to be put to work without a programmer having to be an SCL expert first, although in the long run learning SCL will allow for even more powerful applications. SCL programs can be divided into what are known as Labeled Sections. These labeled sections allow for the development of modular code and for selective processing. The four main labeled sections are described below: The INIT section is executed when the associated application window (Frame) is opened. This can be used to set an application’s initial conditions. The MAIN section is executed each time a field (control or component) within an application window (Frame) is modified. The RADIOBOX1 section is executed each time the RADIOBOX1 object is modified (when a selection is made). This section always executes before the MAIN section. Every visual component added to the Frame can have its own Labeled Section. The TERM section is executed when an application window (Frame) is closed. This can be used to close files, tables, clean up old variables etc. 10. Remove all label sections except RADIOBOX1. Within a labeled section it is possible to place what are called submit blocks.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us