* File ex3.sps analysis of Scottish Health Survey 1998 data on smoking rates. * We assume you have already opened the data file ex3.sav. * Now define the survey design This can be done interactively via the Analyze and following the responses in the dialogue box In particular at screen 1: Give name of plan file screen 2: Enter psu in the CLUSTER box and grosswt in the WEIGHT box regstrat in the STRATUM box at screen 3: tick sampling with replacement then finish. * Analysis Preparation Wizard. This model uses One Stage the code below was made by pasting at the last stage of the dialogue box. CSPLAN ANALYSIS /PLAN FILE='ex3.csaplan' /PLANVARS ANALYSISWEIGHT=grosswt /PRINT PLAN /DESIGN STRATA= regstrat CLUSTER= psu /ESTIMATOR TYPE=WR. * Now analyse with the plan file you can do this analysis from the complex samples menu (here frequencies). * Similarly fro all the analyses below. * Complex Samples Frequencies for smoking groups. CSTABULATE /PLAN FILE = 'ex3.csaplan' /TABLES VARIABLES = cigst2 /CELLS POPSIZE TABLEPCT /STATISTICS SE CIN(95) COUNT DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. * Now recode to get a group of cigarette smokers. RECODE cigst2 (-8=SYSMIS) (-9=SYSMIS) (-6=SYSMIS) (-1=0) (1=1) (5=0) (2=2) (3=1) (4=1) INTO smoker . VARIABLE LABELS smoker 'current cigarette smoker'. EXECUTE . RECODE cigst2 (-8=SYSMIS) (-9=SYSMIS) (-6=SYSMIS) (-1=0) (1=1) (5=0) (2=1) (3=1) (4=1) INTO smoker . VARIABLE LABELS smoker 'current cigarette smoker'. EXECUTE . * Complex Samples Frequencies for smoker. CSTABULATE /PLAN FILE = 'ex3.csaplan' /TABLES VARIABLES = smoker /CELLS POPSIZE TABLEPCT /STATISTICS SE CIN(95) COUNT DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. * Complex Samples Frequencies for smoker by male/female. CSTABULATE /PLAN FILE = '\ex3.csaplan' /TABLES VARIABLES = smoker /SUBPOP TABLE = sex /CELLS TABLEPCT /STATISTICS SE COUNT DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. * Complex Samples Frequencies for smoker by health board. CSTABULATE /PLAN FILE = 'ex3.csaplan' /TABLES VARIABLES = smoker /SUBPOP TABLE = hboard /CELLS TABLEPCT /STATISTICS SE COUNT DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. * look at smoking by social class first recoding missing data. RECODE sc (-8=SYSMIS) (-9=SYSMIS) (-6=SYSMIS) (-1=sysmis) (else =copy) INTO sc . EXECUTE . * Complex Samples Frequencies for smoker by social class. CSTABULATE /PLAN FILE = 'ex3.csaplan' /TABLES VARIABLES = smoker /SUBPOP TABLE = sc /CELLS TABLEPCT /STATISTICS SE COUNT DEFF DEFFSQRT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE.