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
Stationarity test for residual in panel dataHello everyone, I want to test the statinarity (panel) for the residual in my regression. I use Cod…
Replicate Values from one column to the other in an n-dimension arrayDear Statalists, I am a new Mata user and attempt replicating values from one column to the other i…
How to get the confidence intervals for each lag using PACFDear community, I'm doing running the ac and pac command on data that I've simulated. I'm able to s…
Panel Data Setup; Sales on parallel channelsDear Statalists, as many others, I’m currently struggling with setting up my data for a panel model …
''omitted because of collinearity"While I am running regression in Stata, many times a variable is dropped due to collinearity. In the…
Subscribe to:
Post Comments (Atom)
0 Response to variable with multiple conditions
Post a Comment