Hello.
I'm attempting to create a new variable (metabolic syndrome) based on meeting at least three of five conditions.
gen met=.
. replace met=1 if ((female==1 & waist>35 & waist<.) | (female==0 & waist >40 & waist <.)) ///
> | (a1c>5.7 & a1c<.) | (trigly>=150 & trigly<.) | ((female==1 & hdl<50) ///
> | (female==0 & hdl<40)) | ((sbp>130 & sbp<.) | dbp >85 & dbp<.))
Stata says:
too many ')' or ']'
I suppose I could create variables for each of the conditions and try again. But, the way I've written it would only classify metabolic syndrome if a person met all 5 of the criteria, when they only need to meet at least three.
Anyone have any ideas?
Thanks!
Related Posts with variable with multiple conditions
Is -python script- much slower in Stata 17 than in Stata 16?I use the tuples command (from SSC). The tuples command is implemented in terms of python script and…
How to export polychoric matrix resultsHello everyone I have now searched far and wide for an answer to this question. I am using polychor…
Not show "Standard errors in parenthesis *p <0.10, **p<0.05, ***p<0.001" below table, while keeping the significance stars with esttabHey everyone, As in the title, I'd like to save my regression results in a table, however, I can't …
test - xsmle and interpretationHey listers, I am using the "xsmle" command to run fixed effects models on panel data. I am particu…
Expanding obs depending on several variablesDear Statalist, I have a dataset of several firms patenting. However, there are patents with more th…
Subscribe to:
Post Comments (Atom)
0 Response to variable with multiple conditions
Post a Comment