Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Create a Running Count Variable?


From   Don Ruby <goofnmick@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Create a Running Count Variable?
Date   Fri, 20 May 2011 14:48:57 -0400

Hi everyone,

Suppose I have the following data, where NUML is the variable I want to create.

    +---------------------------------------------------------+
     |  Fid   CHid  YOB  LOWB      NUML      |
     |----------------------------------------------------------|
 1. |    1      11    80         1              0         |
 2. |    1      12    82         0              1         |
 3. |    2      21    78         1              0         |
 4. |    2      22    85         1              1         |
 5. |    2      23    88         1              2         |
    +---------------------------------------------------------+

Where Fid is a family id, CHid is a child id, YOB is year of child's
birth, LOWB is an indicator for whether the child was born with low
birth weight, and NUML is the number of LOWB siblings born previously.

How can I create this running count variable, NUML?


Thanks,

Don

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index