Hello
I am currently working with Panel Data. I have one variable which tells me, if a person lives in poverty (dummy variable). Since I am interessted in long-term poverty, I need a new variable, which tells me how long the poverty spell lastet (or the longest if several poverty spells) (without interuption).
I tried:
by idpers, sort: egen firsttime = min(cond(poverty==1, year, .))
by idpers: egen lasttime = max(cond(poverty==1, year, .))
but with this, it doesn't consider interuptions, but rather givs me the first and last time poverty occurred to the same person.
Thank you very much for the help.
I am currently working with Panel Data. I have one variable which tells me, if a person lives in poverty (dummy variable). Since I am interessted in long-term poverty, I need a new variable, which tells me how long the poverty spell lastet (or the longest if several poverty spells) (without interuption).
I tried:
by idpers, sort: egen firsttime = min(cond(poverty==1, year, .))
by idpers: egen lasttime = max(cond(poverty==1, year, .))
but with this, it doesn't consider interuptions, but rather givs me the first and last time poverty occurred to the same person.
Thank you very much for the help.
Comment