Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Some kind of count or tabulation


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: Some kind of count or tabulation
Date   Fri, 6 Jan 2006 14:12:07 +0100

B. Water:

I understand that your var1-varn are string variables. For strings, the
missing value typically is a blank, not a period, so I would first:

   foreach V of varlist var1-varn {
     replace `V'="" if `V'=="."
   }

If you feel unsecure about the above construct, you might instead give
as many replace commands as you have variables:
   replace var1="" if var1=="."
   ...

Now you can use egen's robs() function with the strok option:
   egen nonmiss = robs(var1-varn) , strok

In Stata 9 the robs() function got the more telling name rownonmiss().

Now, the variable -nonmiss- tells the number of nonmissing (i.e.
non-blank) values for each observation. Wasn't that what you were
looking for?

Hope this helps
Svend

__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: [email protected]
__________________________________________

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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