BP categories
Median SBP
use "data\NHANES0518.dta", clear
egen NmissSBP = rowmiss(bpxsy1 bpxsy2 bpxsy3 bpxsy4)
egen MaxSBP = rowmax(bpxsy1 bpxsy2 bpxsy3 bpxsy4)
egen MedSBP = rowmedian(bpxsy1 bpxsy2 bpxsy3 bpxsy4)
replace MedSBP=. if NmissSBP>2
replace MedSBP=. if NmissSBP==2 & MedSBP!=MaxSBP
save "data\NHANES0518_new.dta",replace
(18,997 missing values generated)
(18,997 missing values generated)
(1,291 real changes made, 1,291 to missing)
(993 real changes made, 993 to missing)
file data\NHANES0518_new.dta saved
use "data\NHANES0518.dta", clear
gen miss_SBP1=missing(bpxsy1)
gen miss_SBP2=missing(bpxsy2)
gen miss_SBP3=missing(bpxsy3)
gen miss_SBP4=missing(bpxsy4)
ta miss_SBP1 miss_SBP2
ta miss_SBP3 miss_SBP4
egen NmissSBP = rowmiss(bpxsy1 bpxsy2 bpxsy3 bpxsy4)
ta NmissSBP miss_SBP1
#save "data\NHANES0518_new.dta",replace
| miss_SBP2
miss_SBP1 | 0 1 | Total
-----------+----------------------+----------
0 | 46,725 1,994 | 48,719
1 | 2,182 19,289 | 21,471
-----------+----------------------+----------
Total | 48,907 21,283 | 70,190
| miss_SBP4
miss_SBP3 | 0 1 | Total
-----------+----------------------+----------
0 | 2,592 45,985 | 48,577
1 | 1,062 20,551 | 21,613
-----------+----------------------+----------
Total | 3,654 66,536 | 70,190
| miss_SBP1
NmissSBP | 0 1 | Total
-----------+----------------------+----------
1 | 47,061 1,701 | 48,762
2 | 674 466 | 1,140
3 | 984 307 | 1,291
4 | 0 18,997 | 18,997
-----------+----------------------+----------
Total | 48,719 21,471 | 70,190
Unknown #command
Median DBP
use "data\NHANES0518_new.dta", clear
egen NmissDBP = rowmiss(bpxdi1 bpxdi2 bpxdi3 bpxdi4)
egen MaxDBP = rowmax(bpxdi1 bpxdi2 bpxdi3 bpxdi4)
egen MedDBP = rowmedian(bpxdi1 bpxdi2 bpxdi3 bpxdi4)
replace MedDBP=. if NmissDBP>2
replace MedDBP=. if NmissDBP==2 & MedDBP!=MaxDBP
save "data\NHANES0518_new.dta",replace
(18,997 missing values generated)
(18,997 missing values generated)
(1,291 real changes made, 1,291 to missing)
(979 real changes made, 979 to missing)
file data\NHANES0518_new.dta saved
use "data\NHANES0518.dta", clear
gen miss_DBP1=missing(bpxdi1)
gen miss_DBP2=missing(bpxdi2)
gen miss_DBP3=missing(bpxdi3)
gen miss_DBP4=missing(bpxdi4)
ta miss_DBP1 miss_DBP2
ta miss_DBP3 miss_DBP4
egen NmissDBP = rowmiss(bpxdi1 bpxdi2 bpxdi3 bpxdi4)
ta NmissDBP miss_DBP1
egen NmissSBP = rowmiss(bpxsy1 bpxsy2 bpxsy3 bpxsy4)
ta NmissSBP NmissDBP
#save "data\NHANES0518_new.dta",replace
| miss_DBP2
miss_DBP1 | 0 1 | Total
-----------+----------------------+----------
0 | 46,725 1,994 | 48,719
1 | 2,182 19,289 | 21,471
-----------+----------------------+----------
Total | 48,907 21,283 | 70,190
| miss_DBP4
miss_DBP3 | 0 1 | Total
-----------+----------------------+----------
0 | 2,592 45,985 | 48,577
1 | 1,062 20,551 | 21,613
-----------+----------------------+----------
Total | 3,654 66,536 | 70,190
| miss_DBP1
NmissDBP | 0 1 | Total
-----------+----------------------+----------
1 | 47,061 1,701 | 48,762
2 | 674 466 | 1,140
3 | 984 307 | 1,291
4 | 0 18,997 | 18,997
-----------+----------------------+----------
Total | 48,719 21,471 | 70,190
| NmissDBP
NmissSBP | 1 2 3 4 | Total
-----------+--------------------------------------------+----------
1 | 48,762 0 0 0 | 48,762
2 | 0 1,140 0 0 | 1,140
3 | 0 0 1,291 0 | 1,291
4 | 0 0 0 18,997 | 18,997
-----------+--------------------------------------------+----------
Total | 48,762 1,140 1,291 18,997 | 70,190
Unknown #command
BP Categories
use "data\NHANES0518_new.dta", clear
gen BP_cat=0
# replace BP_cat=0 if MedSBP<120 & MedDBP<80
replace BP_cat=1 if MedSBP>=120
replace BP_cat=2 if MedSBP>=130 | MedDBP>=80
replace BP_cat=3 if MedSBP>=140 | MedDBP>=90
replace BP_cat=. if MedSBP==. | MedDBP==.
ta BP_cat
label define BP_cat 0 "Normal" 1 "Elevated" 2 "Stage 1 HTN" 3 "Stage 2 HTN"
label values BP_cat BP_cat
label variable BP_cat "BP Category"
ta BP_cat,m
save,replace
Unknown #command
(42,361 real changes made)
(36,514 real changes made)
(28,604 real changes made)
(21,407 real changes made, 21,407 to missing)
BP_cat | Freq. Percent Cum.
------------+-----------------------------------
0 | 26,634 54.60 54.60
1 | 7,042 14.44 69.03
2 | 7,910 16.21 85.25
3 | 7,197 14.75 100.00
------------+-----------------------------------
Total | 48,783 100.00
BP Category | Freq. Percent Cum.
------------+-----------------------------------
Normal | 26,634 37.95 37.95
Elevated | 7,042 10.03 47.98
Stage 1 HTN | 7,910 11.27 59.25
Stage 2 HTN | 7,197 10.25 69.50
. | 21,407 30.50 100.00
------------+-----------------------------------
Total | 70,190 100.00
file data\NHANES0518_new.dta saved
Generate Missing BP Variable
use "data\NHANES0518_new.dta", clear
gen BP_miss=0
replace BP_miss=1 if BP_cat==.
label define BP_miss 0 "Not Missing BP" 1 "Missing BP"
label values BP_miss BP_miss
label variable BP_miss "Meets BP Inclusion Criteria"
ta BP_miss,m
save,replace
(21,407 real changes made)
Meets BP |
Inclusion |
Criteria | Freq. Percent Cum.
---------------+-----------------------------------
Not Missing BP | 48,783 69.50 69.50
Missing BP | 21,407 30.50 100.00
---------------+-----------------------------------
Total | 70,190 100.00
file data\NHANES0518_new.dta saved
Elevated BP
use "data\NHANES0518_new.dta", clear
recode BP_cat 0=0 1=1 2=1 3=1 .=., gen(BP_abn)
label define BP_abn 0 "Normal BP" 1 "Abnormal BP"
label values BP_abn BP_abn
label variable BP_abn "Abnormal/Normal BP"
ta BP_cat BP_abn,m
save,replace
(15107 differences between BP_cat and BP_abn)
| Abnormal/Normal BP
BP Category | Normal BP Abnormal . | Total
------------+---------------------------------+----------
Normal | 26,634 0 0 | 26,634
Elevated | 0 7,042 0 | 7,042
Stage 1 HTN | 0 7,910 0 | 7,910
Stage 2 HTN | 0 7,197 0 | 7,197
. | 0 0 21,407 | 21,407
------------+---------------------------------+----------
Total | 26,634 22,149 21,407 | 70,190
file data\NHANES0518_new.dta saved
Cannabis Use Categories
MJ Use Categories
use "data\NHANES0518_new.dta", clear
ta duq200
ta duq220q
ta duq220u
Ever used |
marijuana |
or hashish | Freq. Percent Cum.
------------+-----------------------------------
1 | 12,593 53.31 53.31
2 | 10,967 46.43 99.75
7 | 34 0.14 99.89
9 | 26 0.11 100.00
------------+-----------------------------------
Total | 23,620 100.00
Last time |
used |
marijuana |
or hashish | Freq. Percent Cum.
------------+-----------------------------------
0 | 180 1.43 1.43
1 | 2,322 18.45 19.88
2 | 1,376 10.93 30.81
3 | 926 7.36 38.17
4 | 540 4.29 42.46
5 | 631 5.01 47.48
6 | 532 4.23 51.70
7 | 359 2.85 54.56
8 | 343 2.73 57.28
9 | 272 2.16 59.44
10 | 494 3.93 63.37
11 | 158 1.26 64.62
12 | 232 1.84 66.47
13 | 151 1.20 67.67
14 | 124 0.99 68.65
15 | 403 3.20 71.86
16 | 113 0.90 72.75
17 | 111 0.88 73.64
18 | 159 1.26 74.90
19 | 81 0.64 75.54
20 | 557 4.43 79.97
21 | 75 0.60 80.56
22 | 131 1.04 81.61
23 | 100 0.79 82.40
24 | 99 0.79 83.19
25 | 380 3.02 86.21
26 | 86 0.68 86.89
27 | 99 0.79 87.68
28 | 101 0.80 88.48
29 | 73 0.58 89.06
30 | 453 3.60 92.66
31 | 61 0.48 93.14
32 | 106 0.84 93.98
33 | 79 0.63 94.61
34 | 53 0.42 95.03
35 | 178 1.41 96.45
36 | 58 0.46 96.91
37 | 36 0.29 97.20
38 | 50 0.40 97.59
39 | 30 0.24 97.83
40 | 67 0.53 98.36
41 | 10 0.08 98.44
42 | 6 0.05 98.49
43 | 6 0.05 98.54
44 | 3 0.02 98.56
45 | 5 0.04 98.60
46 | 1 0.01 98.61
47 | 1 0.01 98.62
48 | 2 0.02 98.63
50 | 1 0.01 98.64
55 | 2 0.02 98.66
56 | 1 0.01 98.67
60 | 5 0.04 98.70
68 | 1 0.01 98.71
71 | 1 0.01 98.72
84 | 1 0.01 98.73
88 | 1 0.01 98.74
90 | 3 0.02 98.76
112 | 1 0.01 98.77
120 | 1 0.01 98.78
143 | 1 0.01 98.78
228 | 1 0.01 98.79
258 | 1 0.01 98.80
291 | 1 0.01 98.81
321 | 2 0.02 98.82
365 | 1 0.01 98.83
369 | 1 0.01 98.84
7777 | 66 0.52 99.36
9999 | 80 0.64 100.00
------------+-----------------------------------
Total | 12,585 100.00
Last time |
used |
marijuana |
or |
hashish/uni |
t | Freq. Percent Cum.
------------+-----------------------------------
1 | 2,695 21.45 21.45
2 | 710 5.65 27.11
3 | 1,534 12.21 39.32
4 | 7,501 59.71 99.03
7 | 53 0.42 99.45
9 | 69 0.55 100.00
------------+-----------------------------------
Total | 12,562 100.00
use "data\NHANES0518_new.dta", clear
recode duq200 2=0 1=1 7=. 9=., gen(MJ_cat)
replace MJ_cat=2 if duq230<77
label define MJ_cat 0 "Never Use" 1 "Past Use" 2 "Current Use"
label values MJ_cat MJ_cat
label variable MJ_cat "Cannabis Use Category"
ta MJ_cat,m
ta MJ_cat duq200,m
save,replace
(11027 differences between duq200 and MJ_cat)
(3,501 real changes made)
Cannabis |
Use |
Category | Freq. Percent Cum.
------------+-----------------------------------
Never Use | 10,967 15.62 15.62
Past Use | 9,092 12.95 28.58
Current Use | 3,501 4.99 33.57
. | 46,630 66.43 100.00
------------+-----------------------------------
Total | 70,190 100.00
Cannabis |
Use | Ever used marijuana or hashish
Category | 1 2 7 9 | Total
------------+--------------------------------------------+----------
Never Use | 0 10,967 0 0 | 10,967
Past Use | 9,092 0 0 0 | 9,092
Current Use | 3,501 0 0 0 | 3,501
. | 0 0 34 26 | 46,630
------------+--------------------------------------------+----------
Total | 12,593 10,967 34 26 | 70,190
| Ever used
Cannabis | marijuana
Use | or hashish
Category | . | Total
------------+-----------+----------
Never Use | 0 | 10,967
Past Use | 0 | 9,092
Current Use | 0 | 3,501
. | 46,570 | 46,630
------------+-----------+----------
Total | 46,570 | 70,190
file data\NHANES0518_new.dta saved
MJ Frequency Categories
use "data\NHANES0518_new.dta", clear
recode duq230 min/10=0 11/20=1 21/30=2 31/max=., gen(MJ_freq)
label define MJ_freq 0 "1-10 days" 1 "11-20 days" 2 "21-30 days"
label values MJ_freq MJ_freq
label variable MJ_freq "Cannabis Use Frequency In the Past 30 Days"
ta MJ_freq,m
ta MJ_freq duq200,m
save,replace
(3514 differences between duq230 and MJ_freq)
Cannabis |
Use |
Frequency |
In the Past |
30 Days | Freq. Percent Cum.
------------+-----------------------------------
1-10 days | 1,993 2.84 2.84
11-20 days | 472 0.67 3.51
21-30 days | 1,036 1.48 4.99
. | 66,689 95.01 100.00
------------+-----------------------------------
Total | 70,190 100.00
Cannabis |
Use |
Frequency |
In the |
Past 30 | Ever used marijuana or hashish
Days | 1 2 7 9 . | Total
-----------+-------------------------------------------------------+----------
1-10 days | 1,993 0 0 0 0 | 1,993
11-20 days | 472 0 0 0 0 | 472
21-30 days | 1,036 0 0 0 0 | 1,036
. | 9,092 10,967 34 26 46,570 | 66,689
-----------+-------------------------------------------------------+----------
Total | 12,593 10,967 34 26 46,570 | 70,190
file data\NHANES0518_new.dta saved
Generate Single MJ Exposure Variable
use "data\NHANES0518_new.dta", clear
gen MJ=MJ_cat
replace MJ=3 if MJ_freq==1
replace MJ=4 if MJ_freq==2
label define MJ 0 "Never Use" 1 "Past Use" 2 "1-10 times in past 30 days" 3 "11-20 times in past 30 days" 4 "21-30 times in past 30 days"
label values MJ MJ
label variable MJ "Cannabis Use"
ta MJ_cat MJ_freq,m
ta MJ,m
ta MJ_freq MJ,m
save,replace
(46,630 missing values generated)
(472 real changes made)
(1,036 real changes made)
Cannabis |
Use | Cannabis Use Frequency In the Past 30 Days
Category | 1-10 days 11-20 day 21-30 day . | Total
------------+--------------------------------------------+----------
Never Use | 0 0 0 10,967 | 10,967
Past Use | 0 0 0 9,092 | 9,092
Current Use | 1,993 472 1,036 0 | 3,501
. | 0 0 0 46,630 | 46,630
------------+--------------------------------------------+----------
Total | 1,993 472 1,036 66,689 | 70,190
Cannabis Use | Freq. Percent Cum.
----------------------------+-----------------------------------
Never Use | 10,967 15.62 15.62
Past Use | 9,092 12.95 28.58
1-10 times in past 30 days | 1,993 2.84 31.42
11-20 times in past 30 days | 472 0.67 32.09
21-30 times in past 30 days | 1,036 1.48 33.57
. | 46,630 66.43 100.00
----------------------------+-----------------------------------
Total | 70,190 100.00
Cannabis |
Use |
Frequency |
In the |
Past 30 | Cannabis Use
Days | Never Use Past Use 1-10 time 11-20 tim 21-30 tim | Total
-----------+-------------------------------------------------------+----------
1-10 days | 0 0 1,993 0 0 | 1,993
11-20 days | 0 0 0 472 0 | 472
21-30 days | 0 0 0 0 1,036 | 1,036
. | 10,967 9,092 0 0 0 | 66,689
-----------+-------------------------------------------------------+----------
Total | 10,967 9,092 1,993 472 1,036 | 70,190
Cannabis |
Use |
Frequency |
In the | Cannabis
Past 30 | Use
Days | . | Total
-----------+-----------+----------
1-10 days | 0 | 1,993
11-20 days | 0 | 472
21-30 days | 0 | 1,036
. | 46,630 | 66,689
-----------+-----------+----------
Total | 46,630 | 70,190
file data\NHANES0518_new.dta saved
Generate Missing MJ Variable
use "data\NHANES0518_new.dta", clear
gen MJ_miss=0
replace MJ_miss=1 if MJ_cat==.
label define MJ_miss 0 "Not Missing MJ" 1 "Missing MJ"
label values MJ_miss MJ_miss
label variable MJ_miss "Meets MJ Inclusion Criteria"
ta MJ_miss,m
ta MJ_miss BP_miss,m
save,replace
(46,630 real changes made)
Meets MJ |
Inclusion |
Criteria | Freq. Percent Cum.
---------------+-----------------------------------
Not Missing MJ | 23,560 33.57 33.57
Missing MJ | 46,630 66.43 100.00
---------------+-----------------------------------
Total | 70,190 100.00
Meets MJ | Meets BP Inclusion
Inclusion | Criteria
Criteria | Not Missi Missing B | Total
---------------+----------------------+----------
Not Missing MJ | 22,321 1,239 | 23,560
Missing MJ | 26,462 20,168 | 46,630
---------------+----------------------+----------
Total | 48,783 21,407 | 70,190
file data\NHANES0518_new.dta saved
Collapsed MJ variable
use "data\NHANES0518_new.dta", clear
recode MJ 0=0 1=0 2=1 3=1 4=2 .=., gen(MJ2)
label define MJ2 0 "Never/Past Use" 1 "Light-Moderate 1-20 times in past 30 days" 2 "Frequent 21-30 times in past 30 days"
label values MJ2 MJ2
label variable MJ2 "Cannabis Use Collapsed"
ta MJ MJ2,m
save,replace
(12593 differences between MJ and MJ2)
| Cannabis Use Collapsed
Cannabis Use | Never/Pas Light-Mod Frequent . | Total
----------------------+--------------------------------------------+----------
Never Use | 10,967 0 0 0 | 10,967
Past Use | 9,092 0 0 0 | 9,092
1-10 times in past 30 | 0 1,993 0 0 | 1,993
11-20 times in past 3 | 0 472 0 0 | 472
21-30 times in past 3 | 0 0 1,036 0 | 1,036
. | 0 0 0 46,630 | 46,630
----------------------+--------------------------------------------+----------
Total | 20,059 2,465 1,036 46,630 | 70,190
file data\NHANES0518_new.dta saved
Inclusion criteria
MEC Examined
use "data\NHANES0518_new.dta", clear
gen MEC_response=1
replace MEC_response=0 if wtmec2yr==0
label define MEC_response 0 "Did not respond" 1 "Responded"
label values MEC_response MEC_response
label variable MEC_response "MEC Response"
ta MEC_response,m
ta MEC_response BP_miss,m
ta MEC_response MJ_miss,m
save,replace
(2,826 real changes made)
MEC Response | Freq. Percent Cum.
----------------+-----------------------------------
Did not respond | 2,826 4.03 4.03
Responded | 67,364 95.97 100.00
----------------+-----------------------------------
Total | 70,190 100.00
| Meets BP Inclusion
| Criteria
MEC Response | Not Missi Missing B | Total
----------------+----------------------+----------
Did not respond | 0 2,826 | 2,826
Responded | 48,783 18,581 | 67,364
----------------+----------------------+----------
Total | 48,783 21,407 | 70,190
| Meets MJ Inclusion
| Criteria
MEC Response | Not Missi Missing M | Total
----------------+----------------------+----------
Did not respond | 0 2,826 | 2,826
Responded | 23,560 43,804 | 67,364
----------------+----------------------+----------
Total | 23,560 46,630 | 70,190
file data\NHANES0518_new.dta saved
Age Inclusion Criteria, 20-59 Years
use "data\NHANES0518_new.dta", clear
recode ridageyr min/19=1 20/59=0 60/85=1 86/max=., gen(AGE_exclude)
label define AGE_exclude 0 "Age 20-59" 1 "Age Excluded"
label values AGE_exclude AGE_exclude
label variable AGE_exclude "Meets Age Inclusion Criteria"
ta AGE_exclude,m
ta AGE_exclude BP_miss,m
ta AGE_exclude MJ_miss,m
save,replace
(68185 differences between ridageyr and AGE_exclude)
Meets Age |
Inclusion |
Criteria | Freq. Percent Cum.
-------------+-----------------------------------
Age 20-59 | 26,269 37.43 37.43
Age Excluded | 43,921 62.57 100.00
-------------+-----------------------------------
Total | 70,190 100.00
Meets Age | Meets BP Inclusion
Inclusion | Criteria
Criteria | Not Missi Missing B | Total
-------------+----------------------+----------
Age 20-59 | 23,411 2,858 | 26,269
Age Excluded | 25,372 18,549 | 43,921
-------------+----------------------+----------
Total | 48,783 21,407 | 70,190
Meets Age | Meets MJ Inclusion
Inclusion | Criteria
Criteria | Not Missi Missing M | Total
-------------+----------------------+----------
Age 20-59 | 22,208 4,061 | 26,269
Age Excluded | 1,352 42,569 | 43,921
-------------+----------------------+----------
Total | 23,560 46,630 | 70,190
file data\NHANES0518_new.dta saved
Overall Inclusion, Age, BP, MJ
use "data\NHANES0518_new.dta", clear
gen include=0
replace include=1 if BP_miss==0 & MJ_miss==0 & AGE_exclude==0
label define include 0 "Excluded" 1 "Included"
label values include include
label variable include "Meets Overall Inclusion Criteria"
ta include,m
ta include BP_miss,m
ta include MJ_miss,m
ta include AGE_exclude,m
save,replace
(21,020 real changes made)
Meets |
Overall |
Inclusion |
Criteria | Freq. Percent Cum.
------------+-----------------------------------
Excluded | 49,170 70.05 70.05
Included | 21,020 29.95 100.00
------------+-----------------------------------
Total | 70,190 100.00
Meets |
Overall | Meets BP Inclusion
Inclusion | Criteria
Criteria | Not Missi Missing B | Total
-----------+----------------------+----------
Excluded | 27,763 21,407 | 49,170
Included | 21,020 0 | 21,020
-----------+----------------------+----------
Total | 48,783 21,407 | 70,190
Meets |
Overall | Meets MJ Inclusion
Inclusion | Criteria
Criteria | Not Missi Missing M | Total
-----------+----------------------+----------
Excluded | 2,540 46,630 | 49,170
Included | 21,020 0 | 21,020
-----------+----------------------+----------
Total | 23,560 46,630 | 70,190
Meets |
Overall | Meets Age Inclusion
Inclusion | Criteria
Criteria | Age 20-59 Age Exclu | Total
-----------+----------------------+----------
Excluded | 5,249 43,921 | 49,170
Included | 21,020 0 | 21,020
-----------+----------------------+----------
Total | 26,269 43,921 | 70,190
file data\NHANES0518_new.dta saved
Covariate Coding
Race/Ethnicity
use "data\NHANES0518_new.dta", clear
#ta ridreth1
recode ridreth1 1=3 2=4 3=1 4=2 5=4, gen(race_eth)
label define race_eth 1 "White-NH" 2 "Black_NH" 3 "Mex Am" 4 "Oth"
label values race_eth race_eth
label variable race_eth "Recoded Race & Ethnicity"
ta race_eth
ta ridreth1 race_eth,m
save,replace
Unknown #command
(70190 differences between ridreth1 and race_eth)
Recoded |
Race & |
Ethnicity | Freq. Percent Cum.
------------+-----------------------------------
White-NH | 25,326 36.08 36.08
Black_NH | 16,072 22.90 58.98
Mex Am | 13,761 19.61 78.59
Oth | 15,031 21.41 100.00
------------+-----------------------------------
Total | 70,190 100.00
Race/Ethni |
city - | Recoded Race & Ethnicity
Recode | White-NH Black_NH Mex Am Oth | Total
-----------+--------------------------------------------+----------
1 | 0 0 13,761 0 | 13,761
2 | 0 0 0 6,847 | 6,847
3 | 25,326 0 0 0 | 25,326
4 | 0 16,072 0 0 | 16,072
5 | 0 0 0 8,184 | 8,184
-----------+--------------------------------------------+----------
Total | 25,326 16,072 13,761 15,031 | 70,190
file data\NHANES0518_new.dta saved
Smoking
use "data\NHANES0518_new.dta", clear
recode smd650 min/10=2 11/20=3 21/95=4 96/max=., gen(SMK_cat)
replace SMK_cat=1 if smq040==3
replace SMK_cat=0 if smq020==2
label define SMK_cat 0 "Never" 1 "Past Smoker" 2 "Light, 1-10 cif/day" 3 "Moderate, 11-20 cig/day" 4 "Heavy, 21+ cig/day"
label values SMK_cat SMK_cat
label variable SMK_cat "Smoking Category"
ta SMK_cat,m
# ta SMK_cat smd650,m
# ta SMK_cat BP_miss,m
# ta SMK_cat MJ_miss,m
save,replace
(8343 differences between smd650 and SMK_cat)
(9,527 real changes made)
(22,876 real changes made)
Smoking Category | Freq. Percent Cum.
------------------------+-----------------------------------
Never | 22,876 32.59 32.59
Past Smoker | 9,527 13.57 46.16
Light, 1-10 cif/day | 5,689 8.11 54.27
Moderate, 11-20 cig/day | 2,540 3.62 57.89
Heavy, 21+ cig/day | 718 1.02 58.91
. | 28,840 41.09 100.00
------------------------+-----------------------------------
Total | 70,190 100.00
Unknown #command
Unknown #command
Unknown #command
file data\NHANES0518_new.dta saved
Gender
use "data\NHANES0518_new.dta", clear
recode riagendr 2=0 1=1, gen(gndr)
label define gndr 0 "Female" 1 "Male"
label values gndr gndr
label variable gndr "Gender"
ta gndr,m
# ta gndr riagendr,m
save,replace
(35481 differences between riagendr and gndr)
Gender | Freq. Percent Cum.
------------+-----------------------------------
Female | 35,481 50.55 50.55
Male | 34,709 49.45 100.00
------------+-----------------------------------
Total | 70,190 100.00
Unknown #command
file data\NHANES0518_new.dta saved
Alcohol
use "data\NHANES0518_new.dta", clear
recode alq130 min/2=0 3/4=1 5/95=2 99/max=., gen(AL_cat)
replace AL_cat=0 if alq101==2 | alq111==2 | alq121==0
replace AL_cat=1 if alq130==2 & riagendr==2
replace AL_cat=2 if alq130==4 & riagendr==2
label define AL_cat 0 "None-Light" 1 "Moderate" 2 "Heavy"
label values AL_cat AL_cat
label variable AL_cat "Alcohol Use Category"
ta AL_cat,m
# ta AL_cat BP_miss,m
# ta AL_cat MJ_miss,m
save,replace
(23615 differences between alq130 and AL_cat)
(8,843 real changes made)
(3,288 real changes made)
(632 real changes made)
Alcohol Use |
Category | Freq. Percent Cum.
------------+-----------------------------------
None-Light | 20,274 28.88 28.88
Moderate | 7,686 10.95 39.83
Heavy | 4,232 6.03 45.86
. | 37,998 54.14 100.00
------------+-----------------------------------
Total | 70,190 100.00
Unknown #command
Unknown #command
file data\NHANES0518_new.dta saved
Healthy Eating Index
use "data\NHANES0518_new.dta", clear
gen hei2015=hei2015_total_score
replace hei2015=. if dr1tkcal==. & dr2tkcal==.
replace hei2015=. if dr1tkcal<500 & dr1tkcal!=.
replace hei2015=. if dr1tkcal>5000 & dr1tkcal!=.
replace hei2015=. if dr2tkcal<500 & dr2tkcal!=.
replace hei2015=. if dr2tkcal>5000 & dr2tkcal!=.
# replace hei2015_total_score=. if dr1tkcal<500
# replace hei2015_total_score=. if dr1tkcal>5000
# replace hei2015_total_score=. if dr2tkcal<500
# replace hei2015_total_score=. if dr2tkcal>5000
label variable hei2015 "Healthy Eating Index"
gen HEI_miss=0
replace HEI_miss=1 if hei2015==.
ta include HEI_miss
save,replace
(13,023 missing values generated)
(0 real changes made)
(467 real changes made, 467 to missing)
(681 real changes made, 681 to missing)
(684 real changes made, 684 to missing)
(258 real changes made, 258 to missing)
Unknown #command
Unknown #command
Unknown #command
Unknown #command
(15,113 real changes made)
Meets |
Overall |
Inclusion | HEI_miss
Criteria | 0 1 | Total
-----------+----------------------+----------
Excluded | 35,606 13,564 | 49,170
Included | 19,471 1,549 | 21,020
-----------+----------------------+----------
Total | 55,077 15,113 | 70,190
file data\NHANES0518_new.dta saved
Education Category
use "data\NHANES0518_new.dta", clear
recode dmdeduc2 1=1 2=2 3=3 4=4 5=5 7=. 9=., gen(EDUC_cat)
label define EDUC_cat 1 "Less than 9th Grade" 2 "Less than High School" 3 "High School/GED" 4 "Some College" 5 "College Graduate"
label values EDUC_cat EDUC_cat
label variable EDUC_cat "Recode Education Level"
ta dmdeduc2 EDUC_cat,m
save,replace
(61 differences between dmdeduc2 and EDUC_cat)
Education |
Level - | Recode Education Level
Adults 20+ | Less than Less than High Scho Some Coll College G | Total
-----------+-------------------------------------------------------+----------
1 | 4,382 0 0 0 0 | 4,382
2 | 0 5,708 0 0 0 | 5,708
3 | 0 0 9,102 0 0 | 9,102
4 | 0 0 0 11,561 0 | 11,561
5 | 0 0 0 0 8,935 | 8,935
7 | 0 0 0 0 0 | 19
9 | 0 0 0 0 0 | 42
. | 0 0 0 0 0 | 30,441
-----------+-------------------------------------------------------+----------
Total | 4,382 5,708 9,102 11,561 8,935 | 70,190
| Recode
Education | Education
Level - | Level
Adults 20+ | . | Total
-----------+-----------+----------
1 | 0 | 4,382
2 | 0 | 5,708
3 | 0 | 9,102
4 | 0 | 11,561
5 | 0 | 8,935
7 | 19 | 19
9 | 42 | 42
. | 30,441 | 30,441
-----------+-----------+----------
Total | 30,502 | 70,190
file data\NHANES0518_new.dta saved
Survey Year
use "data\NHANES0518_new.dta", clear
label define sddsrvyr 4 "2005-2006" 5 "2007-2008" 6 "2009-2010" 7 "2011-2012" 8 "2013-2014" 9 "2015-2016" 10 "2017-2018"
label values sddsrvyr sddsrvyr
label variable sddsrvyr "Survey Year"
ta sddsrvyr,m
save,replace
Survey Year | Freq. Percent Cum.
------------+-----------------------------------
2005-2006 | 10,348 14.74 14.74
2007-2008 | 10,149 14.46 29.20
2009-2010 | 10,537 15.01 44.21
2011-2012 | 9,756 13.90 58.11
2013-2014 | 10,175 14.50 72.61
2015-2016 | 9,971 14.21 86.82
2017-2018 | 9,254 13.18 100.00
------------+-----------------------------------
Total | 70,190 100.00
file data\NHANES0518_new.dta saved
BMI implausible values
use "data\NHANES0518_new.dta", clear
gen BMI_miss=0
replace BMI_miss=1 if bmxbmi==.
ta BMI_miss include,m
replace bmxbmi=. if bmxbmi>65
replace BMI_miss=1 if bmxbmi==.
ta BMI_miss include,m
save,replace
(8,550 real changes made)
| Meets Overall
| Inclusion Criteria
BMI_miss | Excluded Included | Total
-----------+----------------------+----------
0 | 40,709 20,931 | 61,640
1 | 8,461 89 | 8,550
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
(47 real changes made, 47 to missing)
(47 real changes made)
| Meets Overall
| Inclusion Criteria
BMI_miss | Excluded Included | Total
-----------+----------------------+----------
0 | 40,683 20,910 | 61,593
1 | 8,487 110 | 8,597
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
file data\NHANES0518_new.dta saved
MEC weight
use "data\NHANES0518_new.dta", clear
gen wtmec12yr = (1/7) * wtmec2yr
save,replace
file data\NHANES0518_new.dta saved
Cross tabulation of missing variables for T1
use "data\NHANES0518_new.dta", clear
ta EDUC_cat include,m
ta gndr include,m
ta SMK_cat include,m
ta AL_cat include,m
gen AGE_miss =0
replace AGE_miss=1 if ridageyr==.
ta AGE_miss include,m
# gen BMI_miss=0
# replace BMI_miss=1 if bmxbmi==.
ta BMI_miss include,m
gen PIR_miss=0
replace PIR_miss=1 if indfmpir==.
ta PIR_miss include,m
# gen HEI_miss=0
# replace HEI_miss=1 if hei2015==.
ta HEI_miss include,m
| Meets Overall
Recode Education | Inclusion Criteria
Level | Excluded Included | Total
----------------------+----------------------+----------
Less than 9th Grade | 2,940 1,442 | 4,382
Less than High School | 2,798 2,910 | 5,708
High School/GED | 4,364 4,738 | 9,102
Some College | 4,807 6,754 | 11,561
College Graduate | 3,767 5,168 | 8,935
. | 30,494 8 | 30,502
----------------------+----------------------+----------
Total | 49,170 21,020 | 70,190
| Meets Overall
| Inclusion Criteria
Gender | Excluded Included | Total
-----------+----------------------+----------
Female | 24,802 10,679 | 35,481
Male | 24,368 10,341 | 34,709
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
| Meets Overall
| Inclusion Criteria
Smoking Category | Excluded Included | Total
----------------------+----------------------+----------
Never | 10,717 12,159 | 22,876
Past Smoker | 5,862 3,665 | 9,527
Light, 1-10 cif/day | 2,568 3,121 | 5,689
Moderate, 11-20 cig/d | 974 1,566 | 2,540
Heavy, 21+ cig/day | 260 458 | 718
. | 28,789 51 | 28,840
----------------------+----------------------+----------
Total | 49,170 21,020 | 70,190
Alcohol | Meets Overall
Use | Inclusion Criteria
Category | Excluded Included | Total
-----------+----------------------+----------
None-Light | 9,819 10,455 | 20,274
Moderate | 2,028 5,658 | 7,686
Heavy | 805 3,427 | 4,232
. | 36,518 1,480 | 37,998
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
(0 real changes made)
| Meets Overall
| Inclusion Criteria
AGE_miss | Excluded Included | Total
-----------+----------------------+----------
0 | 49,170 21,020 | 70,190
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
Unknown #command
Unknown #command
| Meets Overall
| Inclusion Criteria
BMI_miss | Excluded Included | Total
-----------+----------------------+----------
0 | 40,683 20,910 | 61,593
1 | 8,487 110 | 8,597
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
(6,332 real changes made)
| Meets Overall
| Inclusion Criteria
PIR_miss | Excluded Included | Total
-----------+----------------------+----------
0 | 44,412 19,446 | 63,858
1 | 4,758 1,574 | 6,332
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
Unknown #command
Unknown #command
| Meets Overall
| Inclusion Criteria
HEI_miss | Excluded Included | Total
-----------+----------------------+----------
0 | 35,606 19,471 | 55,077
1 | 13,564 1,549 | 15,113
-----------+----------------------+----------
Total | 49,170 21,020 | 70,190
Cross tabulation of missing variables for T1, by MJ_cat
use "data\NHANES0518_new.dta", clear
svyset sdmvpsu [pw=wtmec12yr], strata(sdmvstra)
ta EDUC_cat MJ_cat if include==1,m
ta gndr MJ_cat if include==1,m
ta SMK_cat MJ_cat if include==1,m
ta AL_cat MJ_cat if include==1,m
gen AGE_miss =0
replace AGE_miss=1 if ridageyr==.
ta AGE_miss MJ_cat if include==1,m
# gen BMI_miss=0
# replace BMI_miss=1 if bmxbmi==.
ta BMI_miss MJ_cat if include==1,m
gen PIR_miss=0
replace PIR_miss=1 if indfmpir==.
ta PIR_miss MJ_cat if include==1,m
# gen HEI_miss=0
# replace HEI_miss=1 if hei2015_total_score==.
ta HEI_miss MJ_cat if include==1,m
svy, subpop(if include==1): ta HEI_miss MJ_cat, col percent
pweight: wtmec12yr
VCE: linearized
Single unit: missing
Strata 1: sdmvstra
SU 1: sdmvpsu
FPC 1: <zero>
Recode Education | Cannabis Use Category
Level | Never Use Past Use Current U | Total
----------------------+---------------------------------+----------
Less than 9th Grade | 1,122 244 76 | 1,442
Less than High School | 1,301 1,050 559 | 2,910
High School/GED | 2,007 1,890 841 | 4,738
Some College | 2,662 2,966 1,126 | 6,754
College Graduate | 2,604 2,153 411 | 5,168
. | 7 1 0 | 8
----------------------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
| Cannabis Use Category
Gender | Never Use Past Use Current U | Total
-----------+---------------------------------+----------
Female | 5,572 3,960 1,147 | 10,679
Male | 4,131 4,344 1,866 | 10,341
-----------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
| Cannabis Use Category
Smoking Category | Never Use Past Use Current U | Total
----------------------+---------------------------------+----------
Never | 7,616 3,643 900 | 12,159
Past Smoker | 993 2,163 509 | 3,665
Light, 1-10 cif/day | 729 1,449 943 | 3,121
Moderate, 11-20 cig/d | 248 800 518 | 1,566
Heavy, 21+ cig/day | 90 231 137 | 458
. | 27 18 6 | 51
----------------------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
Alcohol |
Use | Cannabis Use Category
Category | Never Use Past Use Current U | Total
-----------+---------------------------------+----------
None-Light | 6,237 3,305 913 | 10,455
Moderate | 1,899 2,668 1,091 | 5,658
Heavy | 969 1,557 901 | 3,427
. | 598 774 108 | 1,480
-----------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
(0 real changes made)
| Cannabis Use Category
AGE_miss | Never Use Past Use Current U | Total
-----------+---------------------------------+----------
0 | 9,703 8,304 3,013 | 21,020
-----------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
Unknown #command
Unknown #command
| Cannabis Use Category
BMI_miss | Never Use Past Use Current U | Total
-----------+---------------------------------+----------
0 | 9,657 8,261 2,992 | 20,910
1 | 46 43 21 | 110
-----------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
(6,332 real changes made)
| Cannabis Use Category
PIR_miss | Never Use Past Use Current U | Total
-----------+---------------------------------+----------
0 | 8,769 7,850 2,827 | 19,446
1 | 934 454 186 | 1,574
-----------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
Unknown #command
Unknown #command
| Cannabis Use Category
HEI_miss | Never Use Past Use Current U | Total
-----------+---------------------------------+----------
0 | 9,010 7,762 2,699 | 19,471
1 | 693 542 314 | 1,549
-----------+---------------------------------+----------
Total | 9,703 8,304 3,013 | 21,020
(running tabulate on estimation sample)
Number of strata = 105 Number of obs = 70,190
Number of PSUs = 214 Population size = 306,545,053
Subpop. no. obs = 21,020
Subpop. size = 141,524,461
Design df = 109
--------------------------------------------------
| Cannabis Use Category
HEI_miss | Never Us Past Use Current Total
----------+---------------------------------------
0 | 93.79 94.17 90.56 93.49
1 | 6.213 5.834 9.44 6.506
|
Total | 100 100 100 100
--------------------------------------------------
Key: column percentage
Pearson:
Uncorrected chi2(2) = 170.9026
Design-based F(1.96, 213.52) = 16.8948 P = 0.0000
Create .zip file for github upload
zip("data/NHANES0518_new.zip","data/NHANES0518_new.dta")