[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Marcela Perticara" <mperticara@uahurtado.cl> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: generating a 0,1 variable which depends on lag values |

Date |
Wed, 11 Sep 2002 19:09:42 -0500 |

I think this is what you want. sort industry year by industry: gen sum=sum(action) /*gives you the total amount of actions taken at each point in time*/ gen BB=sum>0 -------------------------------------------- Universidad Alberto Hurtado Erasmo Escala 1835 Santiago, Chile Phono: 671-7130 anexo 267 http://www.ilades.cl/economia/index.html ----- Original Message ----- From: "Nisha Malhotra" <malhotra@econ.bsos.umd.edu> To: <statalist@hsphsun2.harvard.edu> Sent: Wednesday, September 11, 2002 5:33 PM Subject: st: generating a 0,1 variable which depends on lag values > Hi, > > I am facing a problem creating a binary variable. > I have a large panel data set. The three important variables are Year, Industry, Action taken by an industry ( variable that takes the value 0 if no action was taken and 1 if one action was taken and 2 if two actions were taken and so on ) > > The data looks something like this > Year Industry Action > 90 A 0 > 91 A 0 > 92 A 2 > 93 A 0 > 90 B 1 > 91 B 0 > 92 B 0 > 93 B 1 > > I want to create a binary variable say BB, which takes the value 0 if no prior action(in the previous years) has been taken by an industry and 1 if some positive action has been taken by an industry in the previous years. > > Year Industry Action BB > 90 A 0 0 > 91 A 0 0 > 92 A 2 1 > 93 A 0 1 > 90 B 1 1 > 91 B 0 1 > 92 B 0 1 > 93 B 1 1 > > I would really appreciate if someone can help me out with this. > Thanks in advance > > > * > * 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/ ______________________________________ Universidad Alberto Hurtado http://www.uahurtado.cl * * 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/

**References**:**st: generating a 0,1 variable which depends on lag values***From:*"Nisha Malhotra" <malhotra@econ.bsos.umd.edu>

- Prev by Date:
**st: NASUG meeting and Short course announcement** - Next by Date:
**st: generating a 0,1 variable which depends on lag values** - Previous by thread:
**st: generating a 0,1 variable which depends on lag values** - Next by thread:
**st: Re: generating a 0,1 variable which depends on lag values** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |