27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1688 Appendix A<br />

A session must go through initial, input program, and procedure states to be a complete<br />

session. Since all sessions start in the initial state, you need to be concerned primarily<br />

with what commands you need to define your working data file and to analyze the data.<br />

The following commands define a very minimal session:<br />

GET FILE=DATAIN.<br />

FREQUENCIES VARIABLES=ALL.<br />

The GET command defines the working data file and the FREQUENCIES command<br />

reads the data file and analyzes it. Thus, the program goes through the required three<br />

states: initial, input, and procedure.<br />

Typically, a session also goes through the transformation state, but it can be skipped<br />

as shown in the example above and in the diagram in Figure A.1. Consider the following<br />

example:<br />

TITLE ’PLOT FOR COLLEGE SURVEY’.<br />

DATA LIST FILE=TESTDATA<br />

/AGE 1-3 ITEM1 TO ITEM3 5-10.<br />

VARIABLE LABELS ITEM1 ’Opinion on level of defense spending’<br />

ITEM2 ’Opinion on level of welfare spending’<br />

ITEM3 ’Opinion on level of health spending’.<br />

VALUE LABELS ITEM1 TO ITEM3 -1 ’Disagree’ 0 ’No opinion’ 1<br />

’Agree’.<br />

MISSING VALUES AGE(-99,-98) ITEM1 TO ITEM3 (9).<br />

RECODE ITEM1 TO ITEM3 (0=1) (1=0) (2=-1) (9=9) (ELSE=SYSMIS).<br />

RECODE AGE (MISSING=9) (18 THRU HI=1) (LO THRU 18=0) INTO VOTER.<br />

PRINT /$CASENUM 1-2 AGE 4-6 VOTER 8-10.<br />

VALUE LABELS VOTER 0 ’Under 18’ 1 ’18 or over’.<br />

MISSING VALUES VOTER (9).<br />

PRINT FORMATS VOTER (F1.0).<br />

FREQUENCIES VARIABLES=VOTER, ITEM1 TO ITEM3.<br />

The program starts in the initial state, where it processes the TITLE command. It then<br />

moves into the input state upon encountering the DATA LIST command. The program<br />

can then move into either the transformation or procedure state once the DATA LIST<br />

command has been processed.<br />

In this example, the program remains in the transformation state after processing<br />

each of the commands from VARIABLE LABELS through PRINT FORMATS. The<br />

program then moves into the procedure state to process the FREQUENCIES command.<br />

As shown in Figure A.1, the program can repeat the procedure state if it encounters a<br />

second procedure. The program can return to the transformation state if it encounters<br />

additional transformation commands following the first procedure. Finally, in some<br />

sessions the program can return to the input program state when it encounters<br />

commands such as FILE TYPE or MATCH FILES.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!