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
Using the character ehat_t in the y-axisDear all, I hope you are all keeping well! I want to use the character ehat_t in my y-axis So I t…
Help manipulating data groupsHello, I am currently working with data about initial operations and subsequent readmissions which a…
Plotting nonlinear predicted probabilities from multivariate model against a continous variableApologies if this has already been answered, but I have been unable to find a clear answer/I am not …
Different lagged variablesHello, I am trying to generate a variable based on the lagged values of other variables, where the t…
geonear r(459) error message adviceHi All, I am trying to calculate the distance of disaster occurrences from specific place names wit…
Subscribe to:
Post Comments (Atom)
0 Response to variable with multiple conditions
Post a Comment