Html Version of SPSS Code to run exemplar 2
It is intended to show you the code and to allow links, not to use
as an SPSS syntax file. The SPSS syntax is in  is the file ex2.sps which you should
save to a file and/or read in to SPSS.
To see output from the commands go to the SPSS results file.

Links in this page Simple means and proportions Table 2.3 Table by council area Effect of design aspects on precision of estimates table 2.4
Tables 2.6 onwards
Lines starting with * and ending in a full stop are SPSS COMMENTs These are shown in green here
* Written by Gillian Raab August 2004. * Now we need to set up the plan file which can be done.
* most easily interactively (see the mini guide).
* This syntax was generated by pasting from the menu .
* You will need to change the name of the plan file to its file name on your machine.

* Analysis Preparation Wizard.
CSPLAN ANALYSIS
/PLAN FILE='G:\peas\ex2datafiles\data\ex2.csaplan'
/PLANVARS ANALYSISWEIGHT=GROSSWT
/PRINT PLAN
/DESIGN STRATA= stratum CLUSTER= psu
/ESTIMATOR TYPE=WR.

* Complex Samples Frequencies. back to top uparrow CSTABULATE /PLAN FILE = 'G:\peas\ex2datafiles\data\ex2.csaplan' /TABLES VARIABLES = intuse /CELLS POPSIZE tablepct /STATISTICS SE CIN(95) DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE.

* Complex Samples Frequencies.

CSTABULATE /PLAN FILE = 'G:\peas\ex2datafiles\data\ex2.csaplan' /TABLES VARIABLES = intuse /SUBPOP TABLE = sex DISPLAY=LAYERED /CELLS TABLEPCT /STATISTICS SE COUNT DEFF /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE.

* Complex Samples Frequencies.

CSTABULATE /PLAN FILE = 'G:\peas\ex2datafiles\data\ex2.csaplan' /TABLES VARIABLES = RC5 /CELLS TABLEPCT /STATISTICS SE CIN(95) DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE.

* Complex Samples Frequencies.

back to top uparrow

* To get proportions by council area. CSTABULATE /PLAN FILE = 'G:\peas\ex2datafiles\data\ex2.csaplan' /TABLES VARIABLES = intuse /SUBPOP TABLE = COUNCIL DISPLAY=LAYERED /CELLS TABLEPCT /STATISTICS SE COUNT DEFF /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE.

* Complex Samples Crosstabs.

back to top uparrow

* To get chi-squared tests CSTABULATE /PLAN FILE = 'G:\peas\ex2datafiles\data\ex2.csaplan' /TABLES VARIABLES = intuse BY sex /CELLS POPSIZE /STATISTICS SE DEFF DEFFSQRT /TEST ODDSRATIO INDEPENDENCE /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE.

* to check the effect of different designs as for Table 2.4. * It is necessary to set up a new plan file. * This one checks out what the design effects would be without clustering. * It has been given a differnt name here.

back to top uparrow

* Analysis Preparation Wizard.

CSPLAN ANALYSIS /PLAN FILE='G:\peas\ex2datafiles\data\ex2v2.csaplan' /PLANVARS ANALYSISWEIGHT=GROSSWT /PRINT PLAN /DESIGN STRATA= stratum CLUSTER= UNIQID /ESTIMATOR TYPE=WR.

* Complex Samples Frequencies.

CSTABULATE /PLAN FILE = 'G:\peas\ex2datafiles\data\ex2v2.csaplan' /TABLES VARIABLES = intuse /CELLS POPSIZE tablepct /STATISTICS SE CIN(95) DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE.