|
III. Using SAS for Windows
1. Windows Display System
The new SAS 9 expands from the previous version to include three
new elements on top of its basic three window display system. The
Explorer window and Results
window provide user better control and organization of the SAS objects (e.g. SAS
libraries, SAS data sets) and system output. The latest
Enhanced Editor provides a more sophisticated programming editor that is
equipped with color coding, macro features and better customizability for
programmers' needs. For more new features of the new Enhanced Editor, see
Appendix I.
Despite that there are more windows to deal with, the new SAS 9 workspace is
more versatile and easier to use with the new windowing design.
In its original design, the SAS Display Manager System is composed of three
smaller windows labeled Explorer,
Log, and
Output. The first of which is for program
input while the latter two respectively provide the program system log
information and the output of the program. The program log is primarily
diagnostics of the programming syntax and gives information about if the program
was written correctly and hints for debugging otherwise. It also reports
information about site license, user information, and the SAS release number.
The Output window is where results output by SAS procedures are shown. If the
program does not go through correctly, the output window will usually be blank
or report the previous output.

The new Explorer window provides easy access to SAS objects such as File
shortcuts and Libraries objects. You can assign SAS programs or different
versions of the same program to a clickable shortcut object using the File
shortcut. Accessing SAS libraries and data sets are much easier in version 8.
All objects are clickable with activation of appropriate windows such as the
Viewtable window for data sets.
The Result window is another Windows Explorer-like utility that allows output
to be organized in a hierarchical fashion.
2. Keys Windows - A Road Map to SAS windows
The new SAS 9 has even more windows than its predecessor. To name a few,
apart from the three default windows, they include the Library window, Filename
window, Viewtable window, Keys window, Options window, Graphic windows, etc. It
is imperative to use a "Road Map" to surf around the SAS workspace. The
Keys window plays such a role that guides
and gives you shortcuts to different windows. To activate the Keys window,
point and click on the Command box at the upper left corner and type "keys"
(case-insensitive).

The Keys window allows you to assign function keys to switch to the most
frequently used windows and perform the most used functions. In the above
example, the F5, F6 and F7 are assigned to default windows (Program Editor,
Log and Output respectively) as in the previous versions and versions in other
operating environments. For the rest of the function keys and hot keys (a
combination of function keys, letter keys Control and/or Shift keys), you are
basically free to assign what you want or what you use most. For instance,
assigning F12 to "next" allows you to switch to the next window, F2 to "lib" to
open the library window, etc. It is much more convenient to use the function
keys than clicking on the menu to perform the frequently used functions or
windows. An alternative is to take advantage of the window tabs at the bottom
of the SAS window. Taking after the Windows taskbar, this SAS taskbar provides
shortcuts to the open windows.
3. Entering SAS Statements
To enter SAS statements, simply move the cursor in the Enhanced Editor window
and click the left mouse button.
A SAS program normally starts with a data step. Each statement can go on
several lines, but it MUST end with a semi-colon. If you want to go to
the next line, simply press ENTER.
Conventions on Windows operations are applicable in SAS for Windows. Cutting
and pasting, for example, make program editing much easier for users.
By default, SAS for Windows displays the five windows simultaneously. But,
you can select Cascade or Tile under Window option at the menu bar to choose the
format of display.
Normally, only one window is active at a time. Simply moving the cursor to a
particular window and click within the window area and the color change on the
panel (top bar of the window) notifies which is the active window. When you
enter a SAS session, the Program Editor window is active by default. To make the
LOG window active, type LOG at the command box located at left hand corner
underneath the menu bar.
4. Submitting SAS Statements
When you have entered your program correctly, you are ready to submit these
statements for execution. There are many ways to do so. You can:
1. Highlight the syntax and press F3 or;
2. type SUBMIT at the command box right below the menu bar or;
3. click your right mouse button and select LOCAL, SUBMIT.

If something goes wrong in your SAS statements, SAS will issue error messages
in the LOG window. To check if there is an error message, you need to go to the
LOG window. Type LOG at the Program Editor command line. Use PageUp and Page
Down keys to scroll up and down the window. When the error is located, you may
want to go back to your SAS program and make some changes. Type PGM at the
command line in the LOG window to make your Program Editor window active. At the
command line in the Program Editor type RECALL, you will get your SAS program
back. An easy way to do so is to hit F4.
5. Saving SAS Statements
If you wish to save your SAS program, click File on the menu and select save.
Give a file name like "A:\mypgm.sas", which saves the SAS program file on to
your flash drive or other storage device. Alternatively, you can also type in the command box "FILE
A:\mypgm.sas". This will save every thing on the Program Editor window into
drive A: under the name MYPGM.SAS. The same applies to the LOG and OUTPUT
windows. Note that by convention, the file extension .sas stands for SAS program
files, .log stands for SAS log files and .lst stands for listing or output
files.
*.sas - SAS program file
*.log - SAS log file
*.lst - SAS output file |
6. Bringing SAS Programs into a SAS Session
If you want to bring a file into the SAS Program Editor window once you have
been in SAS for Windows session, type INCLUDE 'A:\MYPGM.SAS' at the Program
Editor command line. An alternative way is to use the menu bar and choose from
the FILE option. SAS will retrieve a file named 'MYPGM.SAS' from drive A: into
the Program Editor window.
7. Ending a SAS Session
To end a SAS session, double click the uppermost left hand corner button or
type ENDSAS (abbreviated: ENDS) at the command line with any window active. Of
course, you can also end a SAS session by double clicking on the uppermost,
right X to close the program. You can close
any window by typing END at the command line when the window is active.
|