Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | daniel klein <klein.daniel.81@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
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. 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/