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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: AW: Simple loop problem? |

Date |
Thu, 3 Dec 2009 09:14:40 +0100 |

<> Robin may want to dig into Nick`s canonical reference for these problems, http://www.stata-journal.com/sjpdf.html?articlenum=pr0004 Also note that not every problem in connection with the "other members" of a family is as easily solved as this one: http://www.stata.com/support/faqs/data/members.html HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Robin Pleau Gesendet: Donnerstag, 3. Dezember 2009 03:09 An: statalist@hsphsun2.harvard.edu Betreff: st: Simple loop problem? Hello. I am using Stata 9. I have what seems like a simple coding problem but can't figure it out (I'm a relatively new Stata user). I believe the solution lies in the foreach/forvalues commands, but can't seem to come up with a solution. I need to recode a person-level variable based on whether other people in the household have the same characteristic. Specifically, I want to recode the variable hh_3 with the value of 1 (1=the person lives in a three-generational household) if anyone in the household already has hh_3=1. I want to loop through the whole dataset. hh_id person_id hh_3 4003 01 0 4003 02 1 4003 03 0 4004 01 0 4004 02 1 4004 03 1 Thank you for your help. Robin * * 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/ * * 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/

**References**:**st: Simple loop problem?***From:*Robin Pleau <rlpleau@ucdavis.edu>

- Prev by Date:
**st: It's too time-consuming for a simple cumulation** - Next by Date:
**st: AW: It's too time-consuming for a simple cumulation** - Previous by thread:
**st: RE: RE: Simple loop problem?** - Next by thread:
**st: re: 3 equations, 2 endogenous Variables, 1 endogenous variable related to** - Index(es):

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