--- Ying Huang <[email protected]> wrote:
> I have 24 indicator variables (1/0) to indicate insurance coverage in
> 24 monthes. For example, if the survey is in 1997, then the survey
> month refer to Jan to Dec of 1997, and those 24 variables show
> insurance coverage for each month in 97 and 98.
>
> The variable I want to create is again a 1/0 variable, say call it
> "insurance". Starting from the survey month, if any of the following
> 12 insurance coverage indicators = yes, then insurance =1; otherwise
> insurance =0.
say that the indicotor variables are called insured1 till insured24,
then I would type:
egen insured = rowtotal(insured1-insured12)
replace insured = insured >0 if insured < .
You may need to think a bit on how you treat missing values (-rowtotal-
treats a missing value by default as 0)
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/