Statalist


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

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


From   Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: counting the number of nonmissing values in varlist for each observation
Date   Mon, 28 Dec 2009 17:13:40 +0100

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/



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