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

st: Preventing -infix- from trimming string variables


From   Ron�n Conroy <[email protected]>
To   [email protected]
Subject   st: Preventing -infix- from trimming string variables
Date   Wed, 02 Mar 2005 20:08:49 +0000

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

--

Ronan M Conroy ([email protected]) Senior Lecturer in Biostatistics Royal College of Surgeons Dublin 2, Ireland +353 1 402 2431 (fax 2764) -------------------- Just say no to drug reps http://www.nofreelunch.org/

--------------------------------------------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
If you have received this email in error please notify the
originator of the message. This footer also confirms that this
email message has been scanned for the presence of computer viruses.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of The Royal College Of Surgeons in Ireland.

--------------------------------------------------------------------------------------------------------------------


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