------------------------------------------------------------------------------------------------------------------ log: C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex3datafiles\results\ex3.log log type: text opened on: 28 Aug 2005, 12:59:36 . edit - preserve . do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" . /*-------------------------------------------- > File ex3.do > > Gillian Raab October 04 > --------- ---------------------------------------*/ . . /*------------------------------------------------------------ > use this code to read in data file if you have not done so > by clicking on the file > modify the directory to where you have the data stored > > cd "c:/documents and settings/gillian raab/my documents/aprojects/peas/web/exemp3/data" > use ex3.dta,clear > set more off > > set the survey description > and run the svydes to get a description of it > > ALL THE COMMANDS IN THIS SECTION CAN ALSO > BE RUN FROM DIALOGUE BOXES THAT YOU CAN ACCESS BY > GOING TO THE HELP MENU AND SEARCHING FOR SURVEY > COMMANDS > > help svy > > GIVES A CONVENIENT SUMMARY THAT TAKES YOU TO A LIST > OF SURVEY COMMANDS > --------------------------------------------------------*/ . . /*---------------------------------------------------- > first set up the survey design and view its properties with svydes > note that we need strata within regions (regstrat) > ---------------------------------------------------------*/ . svyset [pwei=weighta],psu(psu) strata(regstrat) pweight is weighta strata is regstrat psu is psu . set more off . svydes pweight: weighta Strata: regstrat PSU: psu #Obs per PSU Strata ---------------------------- regstrat #PSUs #Obs min mean max -------- -------- -------- -------- -------- -------- 101 2 48 23 24.0 25 102 2 45 21 22.5 24 103 2 58 18 29.0 40 104 2 65 26 32.5 39 105 2 52 24 26.0 28 106 2 71 35 35.5 36 107 2 68 34 34.0 34 108 2 65 30 32.5 35 109 2 49 24 24.5 25 110 2 54 23 27.0 31 111 2 69 34 34.5 35 112 2 54 23 27.0 31 113 2 59 23 29.5 36 114 2 56 28 28.0 28 115 3 89 21 29.7 34 201 2 57 23 28.5 34 202 2 57 26 28.5 31 203 2 68 34 34.0 34 204 2 64 32 32.0 32 205 2 57 23 28.5 34 206 2 57 28 28.5 29 207 2 56 27 28.0 29 208 2 76 35 38.0 41 209 2 56 28 28.0 28 210 2 52 26 26.0 26 211 2 58 26 29.0 32 212 2 59 23 29.5 36 213 2 64 28 32.0 36 214 2 64 28 32.0 36 215 2 50 23 25.0 27 216 2 65 31 32.5 34 217 2 64 27 32.0 37 218 2 43 16 21.5 27 219 2 63 29 31.5 34 220 2 53 24 26.5 29 221 2 50 21 25.0 29 222 2 50 25 25.0 25 223 2 65 32 32.5 33 224 2 42 19 21.0 23 225 2 61 30 30.5 31 301 2 67 33 33.5 34 302 2 52 25 26.0 27 303 2 61 24 30.5 37 304 2 65 32 32.5 33 305 2 58 27 29.0 31 306 2 65 28 32.5 37 307 2 67 33 33.5 34 308 2 53 22 26.5 31 309 2 63 30 31.5 33 310 2 60 28 30.0 32 311 2 73 32 36.5 41 312 2 58 27 29.0 31 313 2 73 36 36.5 37 314 2 58 27 29.0 31 315 2 65 22 32.5 43 316 2 54 27 27.0 27 317 2 56 24 28.0 32 318 2 63 30 31.5 33 319 2 62 28 31.0 34 320 2 57 18 28.5 39 321 2 50 21 25.0 29 322 2 65 27 32.5 38 323 2 62 30 31.0 32 324 2 48 20 24.0 28 325 2 73 36 36.5 37 326 2 50 19 25.0 31 327 2 56 28 28.0 28 328 2 68 30 34.0 38 329 2 52 22 26.0 30 330 3 82 12 27.3 38 401 2 47 19 23.5 28 402 2 60 23 30.0 37 403 2 40 20 20.0 20 404 2 62 29 31.0 33 405 2 53 24 26.5 29 406 2 51 24 25.5 27 407 2 51 23 25.5 28 408 2 44 21 22.0 23 409 2 60 25 30.0 35 410 2 48 24 24.0 24 411 2 58 20 29.0 38 412 2 51 21 25.5 30 413 2 57 26 28.5 31 414 2 53 21 26.5 32 415 3 91 24 30.3 37 501 2 65 25 32.5 40 502 2 49 20 24.5 29 503 2 62 27 31.0 35 504 2 53 24 26.5 29 505 2 66 29 33.0 37 506 2 59 29 29.5 30 507 2 34 16 17.0 18 508 2 42 15 21.0 27 509 2 47 19 23.5 28 510 2 62 23 31.0 39 511 2 58 26 29.0 32 512 2 57 22 28.5 35 513 2 60 21 30.0 39 514 2 38 18 19.0 20 515 2 50 15 25.0 35 516 2 43 19 21.5 24 517 2 56 24 28.0 32 518 2 53 23 26.5 30 519 2 49 24 24.5 25 520 2 58 28 29.0 30 521 2 44 19 22.0 25 522 2 45 21 22.5 24 523 2 40 13 20.0 27 524 2 57 26 28.5 31 525 2 47 21 23.5 26 601 2 53 24 26.5 29 602 2 62 25 31.0 37 603 2 62 29 31.0 33 604 2 57 25 28.5 32 605 2 65 32 32.5 33 606 2 64 30 32.0 34 607 2 71 35 35.5 36 608 2 71 29 35.5 42 609 2 71 34 35.5 37 610 2 64 31 32.0 33 611 2 55 24 27.5 31 612 2 61 29 30.5 32 613 2 80 37 40.0 43 614 2 42 16 21.0 26 615 2 60 28 30.0 32 616 2 60 29 30.0 31 617 2 62 26 31.0 36 618 2 60 29 30.0 31 619 2 63 29 31.5 34 620 2 75 34 37.5 41 621 2 73 35 36.5 38 622 2 57 24 28.5 33 623 2 83 41 41.5 42 624 2 55 25 27.5 30 625 3 89 26 29.7 32 701 2 67 32 33.5 35 702 2 64 30 32.0 34 703 2 62 30 31.0 32 704 2 62 30 31.0 32 705 2 65 29 32.5 36 706 2 64 28 32.0 36 707 2 51 20 25.5 31 708 2 53 21 26.5 32 709 2 61 29 30.5 32 710 2 58 24 29.0 34 711 2 61 29 30.5 32 712 2 75 33 37.5 42 713 2 50 25 25.0 25 714 2 62 29 31.0 33 715 2 58 28 29.0 30 716 2 64 29 32.0 35 717 2 38 16 19.0 22 718 2 57 24 28.5 33 719 2 51 24 25.5 27 -------- -------- -------- -------- -------- -------- 154 312 9047 12 29.0 43 . /*------------------------------------------------------ > you should find that you have strata each with 2 or (in a few cases) > 3 PSUs > > Now get proportions in cigarette smoking categories and their standard errors > ---------------------------------------------------------*/ . svyprop cigst1 ------------------------------------------------------------------------------ pweight: weighta Number of obs = 9047 Strata: regstrat Number of strata = 154 PSU: psu Number of PSUs = 312 Population size = 9006.178 ------------------------------------------------------------------------------ Survey proportions estimation +-----------------------------------------------------------------------+ | cigst1 Obs Est. Prop. Std. Err. | |-----------------------------------------------------------------------| | Refused/Not answered 14 0.001534 0.000491 | | Dont know 16 0.002548 0.000716 | | schedule not obtained 3 0.000601 0.000371 | | not applicable 3 0.000230 0.000133 | | Never smoked cigarettes at all 3711 0.436668 0.006127 | |-----------------------------------------------------------------------| | Used to smoke cigarettes occasionally 269 0.030702 0.002425 | | Used to smoke cigarettes regularly 1895 0.196159 0.004592 | | Current cigarette smoker 3136 0.331559 0.005967 | +-----------------------------------------------------------------------+ . /*----------------------------------------------------------- > svyprop does not give design effects or confidence intervals > to get these for smokers you need to recode > to a 0/1 variable and get its mean value > -----------------------------------------------------------*/ . recode cigst1 (-9 -8 -6 =.) (-1 1 2 3=0) (4=1),gen(smoker) smoker already defined r(110); end of do-file r(110); . do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" . svymean smoker,deff deft ci Survey mean estimation pweight: weighta Number of obs = 9014 Strata: regstrat Number of strata = 154 PSU: psu Number of PSUs = 312 Population size = 8964.0037 ------------------------------------------------------------------------------ Mean | Estimate Std. Err. [95% Conf. Interval] Deff ---------+-------------------------------------------------------------------- smoker | .3331194 .0060102 .3212486 .3449902 1.465561 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Mean | Deft ---------+-------------------------------------------------------------------- smoker | 1.210604 ------------------------------------------------------------------------------ . end of do-file . exit, clear