Getting Started with SAS

advertisement
Getting Started with SAS
This is a small example just to introduce you to a Windows version of a statistical
software package called SAS. SAS can be found in various computer labs around
campus.
The objective with this example is to show you that SAS has three windows (Editor, Log,
Output) and that you can submit programs from the Editor window. You are not expected
to program or know much about the SAS language after this exercise. It’s just to get you
started using it.
Step 1. Note that SAS has three windows
 Editor: where you type programs for analyzing data
 Log: where error messages and executed SAS commands are printed
 Output: where the result of SAS programs are printed
You can move among these windows by clicking one of the three boxes located
at the bottom of the SAS screen.
Step 2. Below you will find a program for computing summary statistics from a
small data set. Type the program into the Editor window. The program
(with accompanying explanatory notes) is as follows:
data one;
input quiz;
cards;
6
7
10
8
9
9
3
6
5
10
;
proc print;
run;
proc univariate data=one;
var quiz;
run;
The name of the dataset.
data one;
input quiz;
cards;
6
7
10
8
9
9
3
6
5
10
;
proc print;
run;
The name of the variable (quiz)
in the order in which the data will
be read.
“cards” means the data come next.
The data. Each row has one entry for
each observation of the variable named
in the input line. That is, there is one row
for each record or observation in the
dataset. (Here there are 10 quiz scores.)
5
“proc” stands for procedure. We will use a few
SAS procedures this semester. Here we use
a procedure (or “proc”) called “print” This will
print the data set for the quiz variable.
“run” tells SAS to execute the commands
proc univariate;
run;
This is another procedure which computes a lot of summary
statistics for a single variable. Much of this output is not
necessary for us so we will ignore much of it. Nonetheless,
you should focus on the statistics for the data set related to
central tendency and dispersion.
6
Step 3. Once you have a program ready in the Editor window, you are ready to submit the program. To
submit the program, click on the icon of “the little guy running” at the top of the SAS tool bar.
Step 4. The Output window should appear. To see all of the output, you need to use the mouse on the
scroll bar at the right-hand edge of the Output window. Try to locate Basic Statistical
Measures.
Step 5. Click on the Log window box at the bottom of the SAS screen. When everything runs properly,
you should see black and blue text. If you ever see comments in red, that indicates an error in SAS.
Download