Path: janda.org/c10 > Syllabus > Outline > Topics and Readings > Computers in Research > Creating an SPSS File
Lecture 6: Creating an SPSS File
You already entered a small number of cases on 10 American states in your mydata.sps file on hardin.

Now we will create an SPSS file with very simple commands to process this small file.

After logging into hardin, type doit again at the prompt:

hardin(kjanda) 43% doit

Again, you will be asked to provide a name for the "syntax" file. You want to reply mydata to retrieve the file that you created last time.

Name of SPSS syntax file? mydata


Because mydata already exists, doit will not put you in the qedit screen again but will offer its menu of choices for you to decide what you want to do:

C10 doit - Wednesday 09/24/97 15:32:14

1. Edit syntax (qedit mydata.sps)
2. Run SPSS (spss -m < mydata.sps > mydata.lst)
3. Display results (more mydata.lst)
4. Print results
5. C10 Bulletin (more $CLASS/bull)
6. Getinfo for C10 Datasets (getinfo).
7. Change syntax file
8. Quit this menu.


      

You want to add SPSS commands to your raw data, so you want to choose option 1 and re-enter qedit anyway:

Enter your choice: 1

After you press RETURN, you will see your own data set of ten states on the screen.

You must provide SPSS commands to the computer to process these data.

Ultimately, you will have to learn how to use SPSS commands. This time, I list the necessary commands below:

DATA LIST RECORDS=1

/1 STATE 1-8 (A) BLACKPOP 9-12 PCTBLACK 13-16 (1)
CLINTON BILL96 VOTES80 VOTES90 17-24.
BEGIN DATA
. <
. < -- The data for your 10 states go between
. < BEGIN & END DATA
. <
END ATA.
LIST VARIABLES = STATE TO VOTES90.

The data line for your first state should follow the command BEGIN DATA.

 If your file looks roughly like this (except that your 10 states will differ), it's probably right!

Immediately on leaving qedit you will return to control of doit and see the menu again:

File mydata.sps saved.
 

C10 doit - Tuesday 09/28/99 14:39:10

1. Edit syntax (qedit mydata.sps)
2. Run SPSS (spss -m < mydata.sps > mydata.lst)
3. Display results (more mydata.lst)
4. Print results (lp -dvcclaser -o2up mydata.lst)
5. C10 Bulletin (more $CLASS/bull)
6. Getinfo for C10 Datasets (getinfo).
7. Change syntax file
8. Quit this menu.

Process the SPSS commands and your data on states with the help of qedit by choosing option 2:

Enter your choice: 2 (and press return)
Running SPSS. Please be patient!
End of job: 15 command lines 0 errors 0 warnings 0 CPU seconds
C10 doit - Tuesday 09/28/99 14:46:35
1. Edit syntax (qedit mydata.sps)
2. Run SPSS (spss -m < mydata.sps > mydata.lst)
3. Display results (more mydata.lst)
4. Print results (lp -dvcclaser -o2up mydata.lst)
5. C10 Bulletin (more $CLASS/bull)
6. Getinfo for C10 Datasets (getinfo).
7. Change syntax file
8. Quit this menu.

The following line indicates that your job ran successfully.

End of job: 15 command lines 0 errors 0 warnings 0 CPU seconds

To check, choose option 3, "Display results"

Enter your choice: 3
^L26 Sep 97 SPSS for Unix, Release 6.1 (HP9000 xxx )
14:46:34 Northwestern University DCE HP 9000 HP-UX 10.0
For HP-UX 10.0 Northwestern University DCE SPSS ID 193786
1 DATA LIST RECORDS=1
2 /1 STATE 1-8 (A) BLACKPOP 9-12 PCTBLACK 13-16 (1)
3 BILL92 BILL96 VOTES80 VOTES90 17-24.
 
This command will read 1 records from the command file
Variable Rec Start End Format
STATE 1 1 8 A8
BLACKPOP 1 9 12 F4.0
PCTBLACK 1 13 16 F4.1
BILL92 1 17 18 F2.0
BILL96 1 19 20 F2.0
VOTES80 1 21 22 F2.0
VOTES90 1 23 24 F2.0
 

mydata.lst (34%)

<----Press the space bar to see more; the above is only a partial listing that fits on one screen

After you reach the end of the listing, you return to the doit menu.

You want to print the results, so choose option 4:

Enter your choice: 4
 
request id is cresap115-319 (1 file)
Your output file has been queued to print in Cresap 115.
Contact the Lab Consultant if you need help with the printer.
doit - Tuesday 09/26/00 11:01:11

Choose 8 on the doit menu to quit. Then logout. You are finished with the assignment.

Pick up your output (or copy the screen to your own computer and print it out on your own printer) and bring it to class.