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/