* Lines starting with a * and ending with . are COMMENTS. * TO USE THIS FILE JUST HIGHLIGHT THE CODE YOU WANT TO RUN. * AND GO TO THE RUN MENU TO RUN IT or JUST USE Ctrl+R *------------------------------------------------------------------------------------------------. * SPSS Syntax for EXEMPLAR 1. * First just do a simple unweighted mean of hhinc. 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 . * To analyse as a complex sample first set up the survey design in a plan file You will probably find it easier to do this in a window, go to >>analyse >>complex samples. * We will start by looking at just adjusting for weighting. * AT first screen give your plan file a name and a place to be saved. * At the second put GROSS2 for weight (to get design effects right need a grossing up weight). * leave the strata and clusters blank for now. * At next stage tick WR (with replacement) and you are all set - code below was pasted from this and could be just run. * Analysis Preparation Wizard. CSPLAN ANALYSIS /PLAN FILE='ex1a.csaplan' /PLANVARS ANALYSISWEIGHT=gross2 /PRINT PLAN /DESIGN /ESTIMATOR TYPE=WR. * Now look at mean of HHINC and its standard error adjusting for weighting ignoring clustering. * You can analyse as complex samples from windows by going to the complex samples and submenus, (this next one is descriptives) or by pasting the code below into SPSS. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE = '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 and weighted sample. * This can be done from a window too, by putting the variale PSU in the cluster box. * Analysis Preparation Wizard. CSPLAN ANALYSIS /PLAN FILE='ex1b.csaplan' /PLANVARS ANALYSISWEIGHT=gross2 /PRINT PLAN /DESIGN CLUSTER= psu /ESTIMATOR TYPE=WR. * The remaining analyses shown here are pasted from the SPSS Complex survey procedures, note that you need to have the right plan file this one is a plan ex1b with weighting and clustering. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE = 'ex1b.csaplan' /SUMMARY VARIABLES =hhinc /MEAN /STATISTICS SE COUNT POPSIZE DEFF DEFFSQRT CIN (95) /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE. * this makes a plan file (ex1c) that treats one of the post-startification factors (CTBAND) as though it were stratifiction output code has comments. * Analysis Preparation Wizard. CSPLAN ANALYSIS /PLAN FILE='ex1c.csaplan' /PLANVARS ANALYSISWEIGHT=gross2 /PRINT PLAN /DESIGN STRATA= ctband CLUSTER= psu /ESTIMATOR TYPE=WR. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE = 'ex1c.csaplan' /SUMMARY VARIABLES =hhinc /MEAN /STATISTICS SE COUNT POPSIZE DEFF DEFFSQRT CIN (95) /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE. * Now compute variable for lone parents. compute lonep=0. IF (ADULTH=1 & DEPCHLDH > 0) lonep = 1 . EXECUTE . * and use the correct plan file ex1b.csaplan to analyze it. * by subpopulations * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE = 'ex1b.csaplan' /SUMMARY VARIABLES =HHINC /SUBPOP TABLE = lonep DISPLAY=LAYERED /MEAN /STATISTICS SE COUNT POPSIZE DEFF DEFFSQRT CIN (95) /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE.