Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: construct new id variable


From   "Oleksandr Shepotylo" <[email protected]>
To   <[email protected]>
Subject   st: construct new id variable
Date   Wed, 10 Sep 2003 16:49:06 -0400

Dear statalist users,

I have a survey data with following variables:

familyid  personid  inwork
001         01            0
001         02            1
001         03            0
001         04            1
002         01            1
002         02            0

    Inwork is indicator of labor force partisipation. I want to create
variable "inworkid" that will be 0 if inwork=0 and will give numbers 1, 2,3
etc otherwise. In my example:

familyid  personid  inwork  inworkid
001         01            0            0
001         02            1            1
001         03            0            0
001         04            1            2
002         01            1            1
002         02            0            0

How can this be done?

Thank you,

Oleksandr.




*
*   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/



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