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

st: how to count non-numeric obs


From   "Radu Ban" <[email protected]>
To   <[email protected]>
Subject   st: how to count non-numeric obs
Date   Thu, 5 Dec 2002 13:20:02 -0500

Dear all,

I have a flat (ASCII) dataset of 130 columns and roughly 250,000 lines. In
theory all the observations should be numeric, but just by visual inspection
I can tell that's not the case. So now I want to count the number of
non-numeric observations by column.
I'm trying to use -infix-, i.e.
infix var1 1 var2 2 .... var130 130 using ../rawdata/raw.txt

Is there a quick way to put each column into a variable (other than typing
all the indivdual variable names and column numbers), and reading in the
dataset only once?
I know I can do sth like

forvalues i=1/130 {
    infix var`i' `i' using ../rawdata/raw.txt, clear
    sum var`i' *to see how many numeric obs i have
    }

but this would mean having to read in a sizeable dataset 130 times which
would take a long time.

thanks a lot,

Radu Ban



*
*   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