You could probably create a loop over the values 95, 101 and so on,
and add 1 to the respective number inside the loop to get at the
durration. But I would look at -egen-'s -anycount()- function first.
This might be a good way of approching this.
Best
Daniel
--
Hello all,
[...]
I want to make a variable that counts the number of pregnancies for each
woman if outcome is 1 or 5 or if outcome is 2,3,4,6 or 7 and number of
weeks of pregnancy was more than 12 weeks. Number of weeks of
pregnancy is given by aa96 (corresponding to the outcome of the first
pregnancy given by aa95), aa102 (corresponding to the outcome of the
second pregnancy given by aa101), and so on.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/