egen meanr = mean(rain), by(state year)
egen stdr = sd(rain), by(state year)
g flood = rain > meanr + stdr
?
On Fri, 26 Mar 2004, Justin G. Gardner wrote:
> Hello stata listers
>
> I have a panel data on 50 states and I would like to create a dummy variable for "flood" if the rainfall in a state exceeds its mean by more than one standard deviation.
>
> I know there is a way to capture values from various commands. My plan is to summarize by state and then capture the mean and standard deviation for each state. Then generate the dummy variable. The problem is I have yet to find the code to do this. I have seen this done for other commands, you can for example capture the beta hat vector when you use the regress command. Can somebody point me to an online resource?
>
> Thanks for the help.
> Justin G. Gardner
> Department of Agriculture and Consumer Economics
> University of Illinois at Urbana-Champaign
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/