Friday, January 06, 2006

Re: st: Some kind of count or tabulation

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: __________________________________________

* * For searches and help try: * * *


Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?