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

From |
Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk> |

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

Subject |
Re: st: counting the number of nonmissing values in varlist for each observation |

Date |
Mon, 28 Dec 2009 19:39:35 +0100 |

Dear Martin, Thank you very much for the advice! Your suggestion works!

warm regards, Ekaterina Weiss wrote:

<> Just change the "fammem" vars to missing based on your condition before you use -egen-, then: *** forv i=1/10{ replace fammem`i'=. if fammem`i'_liv==30 } *** HTH Martin -------- Original-Nachricht --------Datum: Mon, 28 Dec 2009 18:31:42 +0100 Von: Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk> An: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> Betreff: Re: st: counting the number of nonmissing values in varlist for each observationDear Martin,Thank you very much for the advice! Sorry I should have looked at -helpvarlist-, I only thought of -help egen-.I have got an additional question, I just realised that a couple ofhundred of individuals in my dataset named family members who havepassed away. For these people fammem1_liv etc has a particular value(30). Is it possible to specify the varlist for rownonmiss in a way thatit will presume fammem1 to be missing if fammem1_live==30, fammem2missing if fammem2_live==30 etc.?sincerely yours, Ekaterina<> See the rules at -help varlist-: "?" stands for one character... *** clear* set obs 10 forv i=1/10{ gen fammem`i'=cond(runiform()<.1,.,1) gen fammem`i'_liv=. } egen nmbfammem= rownonmiss(fammem? fammem??) su nmbfammem *** HTH Martin -------- Original-Nachricht --------Datum: Mon, 28 Dec 2009 17:13:40 +0100 Von: Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk> An: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> Betreff: st: counting the number of nonmissing values in varlist foreach observationDear all,I need to create a variable which will contain the count the number ofnonmissing values in varlist for each observation for the variablescalled fammem1, fammem2 etc.I came up with the following command: egen nmbfammem= rownonmiss (fammem*) The problem is I have two types of variables starting with fammem: fammem1, fammem2 etc. until fammem10 (which note one's family members) andfammem1_liv, fammem2_liv etc. (which notes whether one lives with thegiven family member in the same household or not)and I only want to create the count of one's family members. Is it possible in Stata 11 to specify varlist as all variables the name of which start with fammem followed by a number between 1 and 10? I will be very grateful for advice, Sincerely yours, Ekaterina * * 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/

* * 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: Cannot allocate more than 779 MB to STATA11***From:*roland andersson <rolandersson@gmail.com>

**Re: st: Cannot allocate more than 779 MB to STATA11***From:*Neil Shephard <nshephard@gmail.com>

**Re: st: Cannot allocate more than 779 MB to STATA11***From:*roland andersson <rolandersson@gmail.com>

**Re: st: Cannot allocate more than 779 MB to STATA11***From:*Neil Shephard <nshephard@gmail.com>

**Re: st: Cannot allocate more than 779 MB to STATA11***From:*Robert A Yaffee <bob.yaffee@nyu.edu>

**Re: st: Cannot allocate more than 779 MB to STATA11***From:*roland andersson <rolandersson@gmail.com>

**Re: st: Cannot allocate more than 779 MB to STATA11***From:*roland andersson <rolandersson@gmail.com>

**Re: st: Cannot allocate more than 779 MB to STATA11***From:*David Kantor <kantor.d@att.net>

**st: counting the number of nonmissing values in varlist for each observation***From:*Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>

**Re: st: counting the number of nonmissing values in varlist for each observation***From:*"Martin Weiss" <Martin.Weiss1@gmx.de>

**Re: st: counting the number of nonmissing values in varlist for each observation***From:*Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>

**Re: st: counting the number of nonmissing values in varlist for each observation***From:*"Martin Weiss" <Martin.Weiss1@gmx.de>

- Prev by Date:
**Re: st: Creating a variable** - Next by Date:
**Re: st: Command to identify number of unique individuals** - Previous by thread:
**Re: st: counting the number of nonmissing values in varlist for each observation** - Next by thread:
**st: RE: counting the number of nonmissing values in varlist for each observation** - Index(es):

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