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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CROSSTABS 327<br />

• The split-file group number, table number, and frequency are written as integers.<br />

• In integer mode, the values of variables are also written as integers. In general mode, the<br />

values are written according to the print format specified for each variable. Alphanumeric<br />

values are written at the left end of any field in which they occur.<br />

• Within each table, records are written from one column of the table at a time, and the<br />

value of the last control variable changes the most slowly.<br />

Example<br />

PROCEDURE OUTPUT OUTFILE=CELLDATA.<br />

CROSSTABS VARIABLES=FEAR SEX (1,2)<br />

/TABLES=FEAR BY SEX<br />

/WRITE=ALL.<br />

• CROSSTABS writes a record for each cell in the table FEAR by SEX to the file CELLDATA.<br />

Figure 1 shows the contents of the CELLDATA file.<br />

Figure 1 Cell records<br />

1 1 55 1 1<br />

1 1 172 2 1<br />

1 1 180 1 2<br />

1 1 89 2 2<br />

Example<br />

PROCEDURE OUTPUT OUTFILE=XTABDATA.<br />

CROSSTABS TABLES=V1 TO V3 BY V4 BY V10 TO V15<br />

/WRITE=CELLS.<br />

• CROSSTABS writes a set of records for each table to file XTABDATA.<br />

• Records for the table V1 by V4 by V10 are written first, followed by records for V1 by V4<br />

by V11, and so on. The records for V3 by V4 by V15 are written last.<br />

Reading a CROSSTABS Procedure Output File<br />

You can use the file created by WRITE in a subsequent session to reproduce a table and<br />

compute statistics for it. Each record in the file contains all the information used to build the<br />

original table. The cell frequency information can be used as a weight variable on the<br />

WEIGHT command to replicate the original cases.<br />

Example<br />

DATA LIST FILE=CELLDATA<br />

/WGHT 9-16 FEAR 17-24 SEX 25-32.<br />

VARIABLE LABELS FEAR ’AFRAID TO WALK AT NIGHT IN NEIGHBORHOODS’.<br />

VALUE LABELS FEAR 1 ’YES’ 2 ’NO’/ SEX 1 ’MALE’ 2 ’FEMALE’.<br />

WEIGHT BY WGHT.<br />

CROSSTABS TABLES=FEAR BY SEX<br />

/STATISTICS=ALL.<br />

• DATA LIST reads the cell frequencies and row and column values from the CELLDATA file<br />

shown in Figure 1. The cell frequency is read as a weighting factor (variable WGHT). The

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

Saved successfully!

Ooh no, something went wrong!