Getting Started with SAS®
Here is a bit of information about SAS® to
help you get started.
The SAS® Environment: Programs,
Output, Log, and Graphs
There are four essential elements of the SAS®
environment that you will need to use: programs, output, the
log, and graphs.
- Programs are collections of SAS®
commands, often stored in simple text files having names with the extension
".sas". Examples can be found on the course web site.
- Output is text created by SAS®
when it executes commands. It may include listings of data and numerical
results from statistical computations.
- The log is a sequential record of the processing steps that
SAS® has executed. Warnings and error
messages appear in the log. If you get results that are not what you
expect, you should check the log for errors and whether the correct numbers
of observations and variables have been entered.
- High-resolution graphs appear separately from the text output.
How these elements appear depends on your computing environment.
- If you are using a windows-style environment (graphical interface),
your program will appear in a special "Editor" window after it is loaded.
(If your system automatically recognizes
SAS® program files, you may simply
double-click on the file, and SAS® will
start with the program in the "Editor" window. Otherwise, you can start
SAS® and then load the program using
the appropriate option under the "File" menu. You can also type or paste
commands directly in the "Editor" window.) Click on the "Run" button
(or choose the "Run" menu option) to execute the program. Output appears
in a special output window, the log appears in a special log window, and
any high-resolution graphs appear in their own windows.
- If you are using a command-line style environment (as on the
UNIX® computer Grove, without the
graphical interface),
and your program is stored in the text file "myprogram.sas"
in the current directory, type "sas myprogram.sas" to run it. If there are
no errors, the output will appear in a text file named "myprogram.lst".
In any case, the log will appear in the text file "myprogram.log".
Producing high-resolution graphs requires special commands that specify
files and formats in which the graph will be stored. Refer to my page
explaining how to obtain high-resolution SAS® graphs in
PostScript®.
SAS® Statements (Commands)
SAS® programs contain statements of
various types that control input and output. There are two very important
types of statements: DATA statements and PROC statements. Both of these
statements can have many sub-statements that specify details of their
operation.
- DATA statements control the input, output, creation, and modification of
data. You will use them to create SAS®
data sets, which are internal representations of data used by other
statements.
- PROC statements invoke procedures that generate output and graphs,
usually based on a data set.
Unless otherwise specified, the PROC will use the data set most recently
created. PROC statements can do things like listing the contents of
a data set (PROC PRINT), performing a regression analysis (PROC REG),
and producing high-resolution graphics (PROC GPLOT and others).
Many examples of DATA and PROC statements and sub-statements appear in
the example SAS® programs on the course
web site.
There are also other types of statements (like OPTIONS) that
control various aspects of the environment and output.
Finding More Detailed Information
The official SAS® documentation provides
all details about statements and operation. If you are using a
graphical interface, you may be able to find the documentation under the
"Help" system. Otherwise, you can find it on the
SAS® web site under links for
online documentation.
The full documentation is very extensive and can be somewhat overwhelming.
Here are directions to find particular information under the "Contents" menu of
the SAS OnlineDoc®:
- The DATA Statement: SAS OnlineDoc -> Base SAS
-> SAS Language Reference: Concepts ->
DATA Step Concepts
- Allowed names for variables, etc: SAS OnlineDoc ->
Base SAS -> SAS Language Reference: Concepts ->
SAS System Concepts ->
Rules for Words and Names in the SAS Language
- PROC REG and PROC GLM: SAS OnlineDoc -> SAS/STAT
-> SAS/STAT User's Guide ->
The REG Procedure (or The GLM Procedure)
- PROC GPLOT: SAS OnlineDoc -> SAS/GRAPH Reference
-> SAS/GRAPH Procedures -> The GPLOT Procedure
- PROC IML: SAS OnlineDoc -> SAS/IML User's Guide
(The "Language Reference" for IML is especially useful.)
You can also use the "Index" and "Search" options to find what you need.
Back to Course Page