Hi all,
I am using NHANES data to compare the use of a dietary aid between two racial-ethnic groups. This is my first time working with survey data. I am trying to figure out the best way to code for my inclusion criteria so that I am still including the weights of other populations in my analysis without actually including those groups.
I have already survey set my data.
In the following code I create a variable that includes mexican american and non-hispanic whites (my groups of interest) who are not pregnant and above the age of 18.
gen inanalysis=0;
replace inanalysis=1 if ridreth1== 1 | ridreth1== 3;
replace inanalysis=0 if ridageyr<=17;
replace inanalysis=0 if ridexprg==1;
I then want to run a logistic regression that regresses race-ethnicity on my dichotomous outcome (do you use this dietary aid - yes or no). The problem I am having is that my groups of interest are both coded as 1 while all other populations are coded as 0.
For example:
svy: logit cbq611 inanalysis;
I then tried to separate my two subpopulation, both over 18 and not pregnant, as below.
gen mex=0;
replace mex=1 if ridreth1== 1;
replace mex=0 if ridageyr<=17;
replace mex=0 if ridexprg==1;
tab mex;
#delimit;
gen nhw=0;
replace nhw=1 if ridreth1== 3;
replace nhw=0 if ridageyr<=17;
replace nhw=0 if ridexprg==1;
tab nhw;
The issue with this is when I put mexican americans (ma) into a logistic regression (as below) then non-hispanic whites as well as the other racial-ethnic groups are coded as zero so I'm not actually comparing the two groups .
svy: logit cbq611 ma;
How to code for my inclusion criteria (Mexican American or non-Hispanic White, not pregnant and over 18) and subsequently compare the two groups in a logistic regression without dropping all of the other racial ethnic groups and their survey weights?
Thank you all so much.
I am using NHANES data to compare the use of a dietary aid between two racial-ethnic groups. This is my first time working with survey data. I am trying to figure out the best way to code for my inclusion criteria so that I am still including the weights of other populations in my analysis without actually including those groups.
I have already survey set my data.
In the following code I create a variable that includes mexican american and non-hispanic whites (my groups of interest) who are not pregnant and above the age of 18.
gen inanalysis=0;
replace inanalysis=1 if ridreth1== 1 | ridreth1== 3;
replace inanalysis=0 if ridageyr<=17;
replace inanalysis=0 if ridexprg==1;
I then want to run a logistic regression that regresses race-ethnicity on my dichotomous outcome (do you use this dietary aid - yes or no). The problem I am having is that my groups of interest are both coded as 1 while all other populations are coded as 0.
For example:
svy: logit cbq611 inanalysis;
I then tried to separate my two subpopulation, both over 18 and not pregnant, as below.
gen mex=0;
replace mex=1 if ridreth1== 1;
replace mex=0 if ridageyr<=17;
replace mex=0 if ridexprg==1;
tab mex;
#delimit;
gen nhw=0;
replace nhw=1 if ridreth1== 3;
replace nhw=0 if ridageyr<=17;
replace nhw=0 if ridexprg==1;
tab nhw;
The issue with this is when I put mexican americans (ma) into a logistic regression (as below) then non-hispanic whites as well as the other racial-ethnic groups are coded as zero so I'm not actually comparing the two groups .
svy: logit cbq611 ma;
How to code for my inclusion criteria (Mexican American or non-Hispanic White, not pregnant and over 18) and subsequently compare the two groups in a logistic regression without dropping all of the other racial ethnic groups and their survey weights?
Thank you all so much.
Comment