You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
I need to crate a variable with IF AND formula, but I did not find it in Stata. Could you please help me how I can create a variable with this conditions?
generate H = "A" if Y>= 1 & X >= 0.045
replace H = "B" if Y <= 1 & X >= 0.045
replace H = "C" if Y >= 1 & X <= 0.045
replace H = "D" if Y <= 1 & X <= 0.045
Y is crises variable, X is threshold.
But I need to write code, that if sum of Y Variable within the next 24 months is more (less) than 1, then .....
In Excel we can use sum of count using a loop or just sum(A1:A24). I need to have something like in Stata and place it in the code (sum of 24 Months of Y>= 1). Could you kindly help me how to figure out in Stata please.
Comment