SPSS source code for Exemplar1 as an html file.
to view the ouptut from these commands in html go to SPSS results page.

* comments shown in green.
Links in this file
Mean income with various assumptions (table 1.3)
Mean income loneparents (table 1.5)
 
* unweighted  mean.

DESCRIPTIVES
  VARIABLES=hhinc
  /STATISTICS=MEAN STDDEV MIN MAX SEMEAN .

* now a weighted mean.
* This assumes frequency weights.

WEIGHT   BY gross2 .
DESCRIPTIVES
  VARIABLES=hhinc
  /STATISTICS=MEAN STDDEV MIN MAX SEMEAN .

* Now set up a plan file for just a probability weighted sample

back to top

* Analysis Preparation Wizard.
* Analysis Preparation Wizard.
CSPLAN ANALYSIS
 /PLAN FILE='C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp1\data\ex1a.csaplan'
 /PLANVARS ANALYSISWEIGHT=gross2
 /PRINT PLAN
 /DESIGN
   /ESTIMATOR TYPE=WR.

* Complex Samples Descriptives.
CSDESCRIPTIVES
 /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp1\data\ex1a.csaplan'
 /SUMMARY VARIABLES =hhinc
 /MEAN
 /STATISTICS SE COUNT POPSIZE DEFF DEFFSQRT CIN (95)
 /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE.


* Now set up a plan file for a clustered sample with weights.

* Analysis Preparation Wizard.
CSPLAN ANALYSIS
 /PLAN FILE='C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp1\data\ex1b.csaplan'
 /PLANVARS ANALYSISWEIGHT=gross2
 /PRINT PLAN
 /DESIGN  CLUSTER= psu
  /ESTIMATOR TYPE=WR.

* Complex Samples Descriptives.
CSDESCRIPTIVES
 /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp1\data\ex1b.csaplan'
 /SUMMARY VARIABLES =hhinc
 /MEAN
 /STATISTICS SE COUNT POPSIZE DEFF DEFFSQRT CIN (95)
 /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE.


* Now define the post-strata as if they were strata.
* Analysis Preparation Wizard.

CSPLAN ANALYSIS
 /PLAN FILE='C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp1\data\ex1c.csaplan'
 /PLANVARS ANALYSISWEIGHT=gross2
 /PRINT PLAN
 /DESIGN  STRATA= ctband  CLUSTER= psu
  /ESTIMATOR TYPE=WR.

* Complex Samples Descriptives.
* This analysis is wrong but warnings not given.

CSDESCRIPTIVES
 /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp1\data\ex1c.csaplan'
 /SUMMARY VARIABLES =hhinc
 /MEAN
 /STATISTICS SE COUNT POPSIZE DEFF DEFFSQRT CIN (95)
 /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE.

back to top
* and use the correct plan file ex1b.csaplan to analyze.
* by loneparent subpopulations.


* Complex Samples Descriptives.
CSDESCRIPTIVES
 /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex1datafiles\exemp1\data\ex1b.csaplan'
 /SUMMARY VARIABLES =HHINC
 /SUBPOP TABLE = lonep  DISPLAY=LAYERED
 /MEAN
 /STATISTICS SE COUNT POPSIZE DEFF DEFFSQRT CIN (95)
 /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE.