Title: Introduction to the SAS System
1Introduction to the SAS System
2The SAS Environment
3The SAS Environment
The Log Notes, Warnings and Errors
The Explorer Navigation of SAS Libraries
The SAS Environment has five main windows
The Program Editor
4The SAS Environment
The Results Window Index of current output
The Output Window
5The SAS Environment
To run a program
Select submit from the run menu
Click on the running man
Or press F8 on your keyboard
6Managing Results
The Results Window provides bookmarks for all
output
7Managing Results
- Multiple program submissions can (and likely
will) be made in a given session. - In fact, blocks of code can be submitted
individually. - Submissions are cumulative in both the log and
output windows.
8Managing Results
Typing clear into the command box
Since log and output results are cumulative,
clearing windows is often necessary. You can
clear a window by
9Managing Results
Selecting Clear All from the edit menu
10Managing Results
You can also right click in the window to bring
up menu options
11Assigning Hotkeys
- The function keys and other key combinations can
be mapped to certain commands. - To bring up the keys window type keys in the
command box or press F9. - Any legal SAS commands can be used, multiple
commands are separated by semicolons.
12Assigning Hotkeys
I have F12 mapped to a series of commands that
clear the log and output windows and return me
to the program editor.
13Other Stuff to Know
The Break button
The working directory where SAS looks for
input and directs output when a path is
not specified
14Other Stuff to Know
The help menu
15Some Basics
The libname statement assigns a SAS data library
The library name (libref)
The path to where data sets are stored or will be
stored
16Some Basics
- A SAS data library is a directory on your
computer where SAS data sets are stored or will
be stored. - A library reference name (libref) can be assigned
using the libname statement - libname libref path-specification
- The libref must be 8 characters or less contain
only letters, numbers or underscores and begin
with a letter.
17Some Basics
- The path specification can be of two types
- full--beginning with a drive letter or computer
name. - partiala path assumed to be an extension of the
working directory. - Three data libraries are created by default
- worka temporary library, all of its contents are
deleted when the SAS session is ended. - sasusera library designed to give you a
permanent storage location for datasets without
having to assign your own library. - sashelpcontains data sets for examples shown in
the SAS online help (plus some other stuff).
18Some Basics
One option youll need to specify is which
data set to use
Datasets have two- level names in
SAS libref.filename
Analyses are typically done with procedures (proc
for short)
19Data Set Names
- In any SAS session, SAS data sets have two level
names - libref.filename
- If the libref is omitted, the work library is
taken as default.
Library Name
Data Set Name
20Viewing data sets
The Libraries icon allows you to view
all available libraries
Each library is displayed as a file drawer.
Opening any will show all data sets in it.
Double clicking on a data set icon will open it
in table view mode.
21Viewing data sets
By default, variable labels are displayed as the
column headings.
In the data set, each column is a variable, while
each row is an observation
22Viewing data sets
To change this, select Column Names from the View
menu.
These are what you will reference when writing
your SAS code.
23A few other things
- The editor uses color coding
- Bright blue Commands and options
- Purple Quoted text
- This color Numbers and formats
- Red Bad
- (usually)
- All SAS statements end with a semicolon.