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

st: RE: Preventing -infix- from trimming string variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Preventing -infix- from trimming string variables
Date   Wed, 2 Mar 2005 23:20:20 -0000

I started writing a work-around, got some way with -file-
and then thought of a good name, -intext-. 

A -findit- then revealed that Roger Newson had taken every 
such step before, and many more. 

See -intext- on SSC. 

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

Ronán Conroy
 
> I am doing a nightmare task, which entails cleaning up almost 3,000 
> individual files, each one of which represents data on a single study 
> participant. The datafiles contain a myriad of oddities, some 
> of which 
> appears to be corruption, which I have gradually winnowed out (OS X 
> users might like to know that Textalchemy is free, and does a 
> splendid 
> job of cleaning corrupted text files...)
> 
> However, my next step is to read the files, one at a time, 
> into Stata, 
> do some more polishing and write ASCII files. There is a 
> reason for this 
> intermediate step, and it's too tedious to explain, but basically I'm 
> reading the participant's data file as if it were a series of 
> one-line 
> records, eliminating blank lines and trimming duplicate information.
> 
> But here's the problem: I'm using a simple dictionary file
> 
> infix dictionary {
> str var1 1-80
> }
> 
> However, when Stata reads in the data, it trims trailing 
> spaces off the 
> lines. Actually, leading and trailing spaces are important, 
> as this is 
> fixed format data, with varying line lengths. But try as I 
> may, I cannot 
> get Stata to read the entire line including leading and 
> trailing blanks. 
> Any ideas?
> 
> The website of the group which developed the original package 
> was last 
> updated in 1999, and I'm told they don't answer email any 
> more, which is 
> why I have been landed with this pack of puppies...

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