Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Looping over variables

From   daniel klein <>
Subject   Re: st: Looping over variables
Date   Tue, 18 Dec 2012 09:47:28 +0100

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.

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:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index