Welcome to SAS
When working with statistical packages, SPSS and SAS are able to do many of the same things, but the way they are used and present the results is very different. In SPSS, the program is more of a Windows based program with lots of highlighting specific functions and clicking and double clicking buttons. In fact, entering data in SPSS is no different than entering data into a Microsoft Excel file or any other spreadsheet. For this reason, in each statistical chapter we will give you a basic rundown on how each test is completed.
In SAS, however, the program is based in Windows, but the actual processes for analyzing data tends to be more akin to computer programming. Since SAS is more computer programming based, we want to address a couple of important issues at this time. In SAS, all keywords are capitalized. A keyword is simply an instruction that the program needs in order to produce your output. There are a two major keywords that are very important when running SAS. The first important key word is “DATA.” The DATA step of SAS includes any information that is necessary for SAS to understand the information you present it. In SAS, the first couple of lines of code generally look something like this:
DATA biological sex;
INPUT
SEX 1;
The word biological sex after the word DATA indicates that you have named this dataset “biological sex.” The keyword INPUT indicates that you are about to tell SAS what each column of data represents in your SAS DATA file. In other words, you must tell SAS what column you are talking about, which in this case is column one and is represented by the 1 following SEX. For simplicity sake, we’re only going to deal with one column of code here, but in real research you’ll have anything from 150-1000 columns depending on what you are analyzing.
Suppose you had five people in a sample. The first person was a male, the second person was a female, the third person was a female, the fourth person was a male, and the fifth person was a female. In SAS, you cannot write out female and male for each case, so you have to represent those with a numerical indicator. For example, 1 = female and 2 = male. When entering this information into SAS (or into SPSS), the programs understand that every number in a column represents one concept, and every row represents an individual card (or person). So our example would look like this:
CARDS;
2
1
1
2
1
;
You’ll notice that after each keyword (DATA, INPUT, & CARDS) you give the computer the information you want it to have and then end that section with a semicolon. The semicolon is a tool used by SAS to denote that you are finished with that section. So after “DATA biological sex” you place a semicolon to tell SAS that you are done defining the dataset. After the second keyword, INPUT, you place a semicolon after the last input statement, which in this case is SEX 1. If you had more than one input statement, you would place it after the last input statement. For example, let’s suppose that in addition to sex we also put in height (in inches). We could have a data set that looks something like this:
DATA biological sex;
INPUT
SEX 1
HEIGHT 2-3;
CARDS;
275
161
164
270
165
;
We now have a second input statement HEIGHT that consists of two columns (two and three). Notice that the semicolon is placed after the last input statement, in this case HEIGHT. You’ll also notice that there is a semicolon after the CARDS keyword and then one after you have entered all of the cards (or individual participants’ scores).
The second major keyword that you have to be aware of in SAS is called a procedure statement or a PROC statement. A PROC statement is where you tell SAS what you want the program to do with your data. In each separate statistical chapter, we will tell you the different PROC statements necessary to run the different tests. Once you have written the appropriate PROC statement you will be ready to run the test. To run a test in SAS, simply click on the little running person in the tool bar. The first time you hit run, SAS will make sure that your INPUT and PROC statements are correct. It is possible that you will receive error messages at this point. If this happens to you, always double check that the semicolons are in the appropriate places and that everything was spelled correctly. The second time you hit run, SAS will display the results from your procedure statement (assuming there are no errors).