-------------
      name:  <unnamed>
       log:  /Users/thedatacooker/Desktop/Biostat200-2018/Labs-2018/Lab 1/lab 1.smcl
  log type:  smcl
 opened on:   9 Sep 2018, 15:41:27

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. use vct.dta, clear

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. describe

Contains data from vct.dta
  obs:         3,389
 vars:            13                          11 Jul 2018 07:11
 size:        71,169
-------------
              storage   display    value
variable name   type    format     label      variable label
-------------


age               double    %12.0g


auditc            byte      %12.0g


cd4               int       %11.0g


cd4_cat           byte      %11.0g


female            byte      %9.0g


hiv               byte      %12.0g


hungry            byte      %12.0g


lastalc           byte      %20.0g


n_adults          byte      %12.0g


n_child           byte      %12.0g


n_support         byte      %12.0g


religion          byte      %10.0g


sex               byte      %12.0g


-------------
Sorted by: hiv

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. label var age "Age"

. label var auditc "Audit score, last 3 months"

. label var cd4 "CD4 count"

. label var cd4_cat "CD4 count"

. label var hiv "HIV status"

. label var hungry "How often household members go hungry"

. label var lastalc "Last time used alcohol"

. label var female "female sex"

. label var n_adults "# adults in household"

. label var n_child "# people <18yo in household"

. label var n_support "# people supported financially"

. label var religion "Religion"

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. label define yesno 0 "no" 1 "yes"

. label values female yesno

. label define sex 1 "men" 2 "women"

. label values sex sex

. label define hiv 0 "HIV-" 1 "HIV+"

. label values hiv hiv

. label define cd4_cat 0 "<50" 1 "51-250" 2 "251-500" 3 ">500"

. label values cd4_cat cd4_cat

. label define hungry 1 "often" 2 "sometimes" 3 "seldom" 4 "never"

. label values hungry hungry

. label define lastalc 0 "never" 1 ">1 year ago" 2 "within last year"

. label values lastalc lastalc

. label define religion 1 "Protestant" 2 "Catholic" 3 "Saved" 4 "Moslem" 8 "Other"

. label values religion religion

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. codebook religion

-------------
religionReligion
-------------

                  type:  numeric (byte)
label  :  religion, but 2 nonmissing values are not labeled

                 range:  [1,8]                        units:  1
         unique values:  5                        missing .:  2/3,389

            tabulation:  Freq.   Numeric  Label
                         1,002         1  Protestant
                         1,047         4  Moslem
                           576         5
                           679         6
                            83         8  Other
                             2         .

. label list religion
religion:
           1 Protestant
           2 Catholic
           3 Saved
           4 Moslem
           8 Other

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. des

Contains data from vct.dta
  obs:         3,389
 vars:            13                          11 Jul 2018 07:11
 size:        71,169
-------------
              storage   display    value
variable name   type    format     label      variable label
-------------


age               double    %12.0g                      Age


auditc            byte      %12.0g                      Audit score, last 3 months


cd4               int       %11.0g                      CD4 count


cd4_cat           byte      %11.0g       cd4_cat        CD4 count


female            byte      %9.0g        yesno          female sex


hiv               byte      %12.0g       hiv            HIV status


hungry            byte      %12.0g       hungry         How often household members go hungry


lastalc           byte      %20.0g       lastalc        Last time used alcohol


n_adults          byte      %12.0g                      # adults in household


n_child           byte      %12.0g                      # people <18yo in household


n_support         byte      %12.0g                      # people supported financially


religion          byte      %10.0g       religion       Religion


sex               byte      %12.0g       sex


-------------
Sorted by: hiv

. sum

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         age |      3,387    31.72897    9.860256      17.51      79.82
      auditc |      3,244    .6390259    1.483416          0         12
         cd4 |        999    329.2332    266.1177          1       1932
     cd4_cat |        999    1.618619    .9377913          0          3
      female |      3,389    .5417527    .4983272          0          1
-------------+---------------------------------------------------------
         hiv |      3,389    .2959575    .4565393          0          1
      hungry |      3,321    3.603132    .7817434          1          4
     lastalc |      3,377    .9227125    .9101892          0          2
    n_adults |      3,384    1.664598    1.737786          0         12
     n_child |      3,382    1.850089    1.924868          0         12
-------------+---------------------------------------------------------
   n_support |      3,372    3.907177    3.227549          0         20
    religion |      3,387    3.781518    1.994997          1          8
         sex |      3,389    1.541753    .4983272          1          2

. browse

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. gen alc_any=0 if auditc==0
(966 missing values generated)

. replace alc_any=1 if auditc>0 & auditc !=.
(821 real changes made)

. label var alc_any "Any alcohol use"

. label values alc_any yesno // value label yesno is already part of the dataset

. * check to make sure this worked
. tab auditc alc_any, missing

     Audit |
    score, |
    last 3 |         Any alcohol use
    months |        no        yes          . |     Total
-----------+---------------------------------+----------
         0 |     2,423          0          0 |     2,423
         1 |         0        363          0 |       363
         2 |         0        134          0 |       134
         3 |         0        118          0 |       118
         4 |         0        108          0 |       108
         5 |         0         44          0 |        44
         6 |         0         13          0 |        13
         7 |         0         10          0 |        10
         8 |         0          7          0 |         7
         9 |         0         15          0 |        15
        10 |         0          4          0 |         4
        11 |         0          3          0 |         3
        12 |         0          2          0 |         2
         . |         0          0        145 |       145
-----------+---------------------------------+----------
     Total |     2,423        821        145 |     3,389

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. drop alc_any

. recode auditc (0=0 "no") (2/max=1 "yes"), gen(alc_any)
(458 differences between auditc and alc_any)

. label var alc_any "Any alcohol use"

.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. recode auditc (min/2=0 "no") (3/max=1 "yes"), gen(alc_unh)
(821 differences between auditc and alc_unh)

. replace alc_unh = 0 if female==0 & auditc==3
(69 real changes made)

. label var alc_unh "Unhealthy alcohol use"

. * check to make sure this worked
. bysort female: tab auditc alc_unh, m

-------------
-> female = no

     Audit |
    score, |
    last 3 |      Unhealthy alcohol use
    months |        no        yes          . |     Total
-----------+---------------------------------+----------
         0 |     1,042          0          0 |     1,042
         1 |       166          0          0 |       166
         2 |        57          0          0 |        57
         3 |        69          0          0 |        69
         4 |         0         71          0 |        71
         5 |         0         34          0 |        34
         6 |         0          9          0 |         9
         7 |         0          8          0 |         8
         8 |         0          5          0 |         5
         9 |         0         12          0 |        12
        10 |         0          2          0 |         2
        11 |         0          2          0 |         2
        12 |         0          2          0 |         2
         . |         0          0         74 |        74
-----------+---------------------------------+----------
     Total |     1,334        145         74 |     1,553

-------------
-> female = yes

     Audit |
    score, |
    last 3 |      Unhealthy alcohol use
    months |        no        yes          . |     Total
-----------+---------------------------------+----------
         0 |     1,381          0          0 |     1,381
         1 |       197          0          0 |       197
         2 |        77          0          0 |        77
         3 |         0         49          0 |        49
         4 |         0         37          0 |        37
         5 |         0         10          0 |        10
         6 |         0          4          0 |         4
         7 |         0          2          0 |         2
         8 |         0          2          0 |         2
         9 |         0          3          0 |         3
        10 |         0          2          0 |         2
        11 |         0          1          0 |         1
         . |         0          0         71 |        71
-----------+---------------------------------+----------
     Total |     1,655        110         71 |     1,836


.
end of do-file

. do "/var/folders/k6/g1qpp_pn0vj37mtyr3qpz65h0000gn/T//SD51156.000000"

. graph box n_support, over(hungry) name(ins_alc, replace)

.
end of do-file

. exit, clear