Statalist


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

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


From   "Martin Weiss" <[email protected]>
To   [email protected]
Subject   Re: st: counting the number of nonmissing values in varlist for each observation
Date   Mon, 28 Dec 2009 17:25:26 +0100

<>

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 <[email protected]>
> An: "[email protected]" <[email protected]>
> Betreff: st: counting the number of nonmissing values in varlist for each observation

> Dear all,
> I need to create a variable which will contain the count the number of 
> nonmissing values in varlist for each observation for the variables 
> called 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)
> and
> fammem1_liv, fammem2_liv etc. (which notes whether one lives with the 
> given 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/

-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
*
*   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/



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