Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Stripping ASCII characters

From   Sergiy Radyakin <>
To   "" <>
Subject   Re: st: Stripping ASCII characters
Date   Mon, 24 Feb 2014 16:16:10 -0500

the answer is yes, it is possible.

Specifically, you can open the file as a binary for reading, open
another one for writing, read byte-by-byte, decide what to do with
each byte depending on it's value (e.g. you can skip the 255 bytes,
replace them with spaces, or apply some other strategy).

See here:

Best, Sergiy Radyakin

PS: are you absolutely sure the 255s are skipped by -filefilter-?

On Mon, Feb 24, 2014 at 4:03 PM, Thomas, Anthony
<> wrote:
> Hi Statalist,
> When insheeting a csv file using Stata 11 - Unix, Stata aborts with the error:
> too many variables specified
> error in line 5000000 of file
> Output of "hexdump" indicated the file contained control characters
> (^Z), and was in binary format, when it was expected to be ASCII. I
> tried using "filefilter "f1.csv" "f2.csv", from(^Z) to() replace" to
> strip the problem characters, but a hexdump on f2.csv indicates the
> (^Z) are still present. From what I understand ^Z (sub) is used in
> place of a character that cannot be read by Stata, is this the case?
> If so, is there any way to strip these characters from my file prior
> to import?
> Thanks,
> Anthony
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index