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

RE: st: RE: STATA reads numbers as strings


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: STATA reads numbers as strings
Date   Fri, 28 May 2004 14:16:05 +0100

You don't need two versions of the same thing 
to do this. 

. list strvar if mi(real(strvar)) 

or 

. tab strvar if mi(real(strvar)) 

are examples of what you can do with a problematic
string variable strvar. 

Nick 
n.j.cox@durham.ac.uk 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of 
> Joseph McCrary
> Sent: 28 May 2004 13:53
> To: Statalist
> Subject: Re: st: RE: STATA reads numbers as strings
> 
> 
> A bit late, but...
> 
> One thing I've done in the past is read the variable once as 
> a string and
> then again as a number. Then you can find those cases for which the
> numeric version of the variable is missing. At that point, look at the
> string version to see what the problem is. I did this when I 
> did not want
> to dump a whole lot of cases because of the way DSM codes were entered
> into a database. I was able to go back and fix the variables so that I
> lost many fewer cases.
> 
> Joe
> 
> 
> On Tue, 11 May 2004 17:36:27 +0100, "Nick Cox" <n.j.cox@durham.ac.uk>
> said:
> > Some relevant links: 
> > 
> > http://www.stata.com/support/faqs/data/allstring.html
> > 
> > http://www.stata.com/support/faqs/data/newexcel.html
> > 
> > http://www.stata.com/support/faqs/res/statalist.html#spell
> > 
> > Nick 
> > n.j.cox@durham.ac.uk 
> > 
> > jdubas@nd.edu
> >  
> > > I keep trying to import data (csv file) that are all numbers, 
> > > but STATA reads
> > > some of them as string.  How do I get STATA to read it properly?
> > 
> > *
> > *   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/
> *
> *   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/
> 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index