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

RE: st: RE: Can't Read "00020" as a Character in Stata?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Can't Read "00020" as a Character in Stata?
Date   Thu, 30 Jun 2005 01:24:37 +0100

You were perfectly clear before 
and I indicated the solution. Here 
it is again: 

"You must spell out that you want the id read 
as a string variable. The help includes examples." 

In your example, 

infix str ID 1-5 Sale 6-10 using abc.raw

Nick 
[email protected] 

[email protected]
 
> Sorry I was not clear before. Suppose I have the following 
> file in fixed format:
> 
> 000201234
> 000305678
> 000402345
> 000502321
> 
> I am trying to read column 1-5 in charater format, so that I 
> have variables in Stata memory as follows: 
> 
> ID    Sale
> 00020 1234
> 00030 5678
> 00040 2345
> 00050 2321
> 
> The problem is that when I use "infix ID 1-5 Sale 6-10", I 
> have the following because Stata treat:
> 
> ID Sale
> 20 1234
> 30 5678
> 40 2345
> 50 2321
> 
> Thoughts?
> 
> 
> "Nick Cox" <[email protected]> wrote:
> 
> >You must spell out that you want the id read 
> >as a string variable. The help includes examples. 
> >
> >Nick 
> >[email protected] 
> >
> >[email protected]
> > 
> >> I encounter a data input problem in Stata. I have a fixed 
> >> format file, i.e., abc.raw, and there are ID numbers that I 
> >> would like to read them in character format. However, the way 
> >> the ID numbers are created makes it hard to do so. For 
> >> example, I have an ID is "00020", but Stata read it as "20". 
> >> Can anyone help me out here? I use "infix id 1-5 using ..." 
> >> but it does not work.

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