Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: using SAS-like arrays to create new variables


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: using SAS-like arrays to create new variables
Date   Sat, 24 Sep 2005 13:38:52 -0400

see -help egen-, I think anycount is what you are looking for. For example, if the child variable are called child1 - child7 (and are in order in the dataset), you could

egen count1=anycount(child1 - child7), values(1)
egen count2=anycount(child1 - child7), values(2)
egen count3=anycount(child1 - child7), values(3)

you could wrap these up in a forvalues loop if you want, but with just 3 , it's fine to leave as is.

Michael Blasnik
[email protected]

*
* 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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index