Psychology 815: Introduction.
August 30, 1996
Introduction to SAS
Why SAS?
Given the popularity of SPSS in many psychology departments (including
MSU), as well as the availability of other software programs like SYSTAT,
some of you might be wondering why SAS was chosen for the statistics courses.
SAS was selected for several reasons. First of all, like SPSS, SAS is
widely used by psychologists all over the country. Also like SPSS, SAS
(windows) has a very user friendly, windows driven component (called SAS-Assist)
that makes even complex analyses easy to perform. However, SAS is also
more flexible than SPSS, allowing more experienced users to bypass SAS-Assist
and write their own programs.
The first part of this course will familiarize you with SAS-Assist.
Within a short time, you will find that you are able to run analyses such
as correlations, regressions, T-tests, and ANOVAs with relative ease. As
you gain expertise with SAS-Assist, some of the computer assignments will
begin to require you to write some simple programs. By the end of the year,
you'll find yourself flipping back and forth between SAS-Assist and simple
programming, choosing one or the other depending on the task.
Finally, although SAS is more complex and is initially harder to master
than SPSS, students have generally found it relatively easy to pick up
SPSS once they were familiar with SAS. Going from SPSS to SAS, on the other
hand, is usually not so easy.
SAS Display Windows
When you load SAS, you see a tool bar and pull-down menus at the top of
the screen and two windows: Log and Program Editor. Look at all of the
options in the pull-down menus. Some of them like "open file" and "save
as" will probably seem familiar to you, if you have used a word processor.
Other options like "submit" will probably be new to you. Don't worry, for
now, if you don't understand what the options do, just look at them and
try to figure out how they are organized. Notice, for example, that the
"Globals" menu is always the same, but the "Locals" menu changes, depending
on which display window your cursor is located.
The Tool Bar: Everything that is in the tool bar can also
be found in the pull-down menus.
-
Starting on the left side, the big "S" stands for "Submit" which is the
SAS term for running a program.
-
"S" is followed by two folders: The first is "Open File," while the second
is "Save As."
-
"Print" is the next item on the tool bar.
-
After "Print," the scissors are "Cut," followed by "Copy" and "Paste."
-
The next icon of the arrow (actually looks like a ribbon) stands for "Go
Back" or "Undo." When you click on this item, SAS will undo the last thing
that you did.
-
After "Undo," comes the "C-Prompt." When you click here, SAS will give
you the DOS screen. However, although it seems as though you are in DOS,
you have not actually exited windows and SAS is still running. Typing "Exit"
at any DOS prompt will bring you back to the SAS session.
-
The next button shows a picture of a file cabinet. When you click here,
SAS will display its data libraries. Much like "File Manager" in windows,
you can click on a directory to see the files that are in that directory.
You can even click on a data file to look at the variables in that data
set. Please note that it is not possible to make any changes to the files
or even to move them from one directory to another. The only thing that
SAS will let you do here is look. If you want to move files from one directory
to another, you must either use "File Manager" in Windows or do it through
regular DOS commands. If you want to edit the data set, you must either
edit the raw data file or you may use Program Editor or SAS-Assist to manipulate
the data. This will be covered in more detail later.
-
The grid-looking icon is "SAS-Assist"which is discussed in detail below.
-
The last button on the tool bar is the question mark, which, of course,
is "Help."
The reason that these options are found on the tool bar is that they
are all used very frequently, so play around with them, until you have
a clear understanding of what each one does.
Log
This is the window that SAS uses to communicate with you. If you did something
wrong, you will find error messages telling you what the problem is. Error
messages are in red. SAS also tells you when you've successfully done something.
For example, if you are trying to create a data set, SAS will tell you
that a data set was created as well as how many variables and observations
are in the data set. The Log will also show the program that was created
by SAS-Assist. This can be a good way to learn how to program. For example,
if you run a correlation using SAS-Assist and then look at the log, you
will find the statement "PROC CORR" in the Log. This is the SAS
term for the correlation procedure. Note that although when you "Submit"
your program, you can see it in the Log, you cannot edit your program in
the log. To edit a program, you must be in the Program Editor.
Program Editor
All programs are written, edited, or looked at in this window. When you
open a previously written program, it will appear here automatically. If
you want to start writing a program from scratch, you should do so in Program
Editor. Note: SAS-Assist takes the place of Program Editor by accessing
stored programs. However, these stored programs will appear in the Log
only, not in the Program Editor.
Output
Although it is not on the screen initially, there is also a display window called
"Output." This window automatically appears whenever you run an analysis. You
can also access this window by clicking "output" in the "Globals" menu.