Html Version of SPSS Code to run exemplar 5 weighting 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 ex5.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 proportions Two way table Simple proportions Means Ordinary (non survey weighted) regression back to top GET * FILE='C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp5\data\ex5.sav'. * Line above reads in the data. If you have opened ex5.sav interactively you won't need to include it. * Next stage is to set up survey design. Again you can do this interactively, via the complex samples menu. * but we have pasted the syntax here. Obviously you need to change directory for your file. * For this exemplar only weights need to be defined and we must be careful to use the GROSSING UP WEIGHT gweight. * Analysis Preparation Wizard. CSPLAN ANALYSIS /PLAN FILE='F:\peas\ex5datafiles\data\ex5.csaplan' /PLANVARS ANALYSISWEIGHT=gweight /PRINT PLAN /DESIGN /ESTIMATOR TYPE=WR. *further steps can also be done from the menus * and the code generated with paste button.. back to top * Complex Samples Frequencies. CSTABULATE /PLAN FILE='F:\peas\ex5datafiles\data\ex5.csaplan' /TABLES VARIABLES = genhelf q85a /CELLS TABLEPCT /STATISTICS SE COUNT DEFF /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE='F:\peas\ex5datafiles\data\ex5.csaplan' /SUMMARY VARIABLES =genhelf sacc sinc /MEAN /STATISTICS SE COUNT DEFF /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE. back to top * Complex Samples Crosstabs. CSTABULATE /PLAN FILE='F:\peas\ex5datafiles\data\ex5.csaplan' /TABLES VARIABLES = genhelf BY q85a /CELLS COLPCT /STATISTICS SE DEFF /TEST INDEPENDENCE /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. * Now with a finite population correction. back to top * Analysis Preparation Wizard. CSPLAN ANALYSIS /PLAN FILE='F:\peas\ex5datafiles\data\ex5.csaplan' /PLANVARS ANALYSISWEIGHT=gweight /PRINT PLAN /DESIGN /ESTIMATOR TYPE=EQUAL_WOR /POPSIZE VALUE=29457. * And rerunning to see what difference this makes in one case. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE='F:\peas\ex5datafiles\data\ex5.csaplan' /SUMMARY VARIABLES =genhelf sacc sinc /MEAN /STATISTICS SE COUNT DEFF /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE. back to top * note that SPSS complex surveys does not currently do regressions but that a weighted regression with weights that add to the number of subjects will give identical estimates and for a survey like this with no stratification or clustering it will give standard errors that are acceptable although based on a model-based rather than a randomisation principle. * we compare them here with what otehr packages give. * first get the mean of the weights; descriptives VARIABLES=weight /STATISTICS=MEAN . * get a new weight that adds to sample size for all respondents. * before the regressions we need to recode the cannabis and amphetamine variables. compute nweight=weight/1.2055. execute. RECODE q85a (1=0) (2=0) (3=1) (4=1) (5=1) (6=0.5) INTO canscore . VARIABLE LABELS canscore "'scored cannabis'". RECODE q85b (1=0) (2=0) (3=1) (4=1) (5=1) (6=0.5) INTO ampscore . VARIABLE LABELS ampscore "'scored amphetamines". EXECUTE . * now run various regressions. REGRESSION /MISSING LISTWISE /REGWGT=nweight /STATISTICS COEFF OUTS /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT genhelf /METHOD=ENTER canscore . REGRESSION /MISSING LISTWISE /REGWGT=nweight /STATISTICS COEFF OUTS /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT genhelf /METHOD=ENTER sinc . REGRESSION /MISSING LISTWISE /REGWGT=nweight /STATISTICS COEFF OUTS /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT genhelf /METHOD=ENTER ampscore . REGRESSION /MISSING LISTWISE /REGWGT=nweight /STATISTICS COEFF OUTS /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT genhelf /METHOD=ENTER canscore ampscore sinc .