Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Failure to detect strings that look completely identical


From   Ronan Conroy <rconroy@rcsi.ie>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Failure to detect strings that look completely identical
Date   Wed, 23 Nov 2011 14:01:26 +0000

On 2011 Samh 22, at 19:50, Nick Cox wrote:

> The help for -charlist- (SSC) documents that char(32) and char(160)
> are hard to tell apart:
> 
> . di "|`=char(32)'|"
> | |
> 
> . di "|`=char(160)'|"
> | |
> 
> So, watch out for char(160).

Your mileage may vary

Mac OS X

. di "|`=char(160)'|"
|†|

. di "|`=char(32)'|"
| |

I got caught out, years ago, by data contaminated by ASCII 30 - the infamous null character. It was used by MS Word to indicate end of file, and could sneak into data. 

. di "|`=char(30)'|"
||

However, if I paste this output into BBEdit and view invisibles, I can see the little horror, which BBEdit displays as a red ¿. (If your mailer hasn't shown you a Spanish inverted question mark, well, that's mailers for you.)

. di "|`=char(30)'|"
|¿|

Null is particularly nasty because it has no width, so it's very hard to spot.



Ronán Conroy
rconroy@rcsi.ie
Associate Professor
Division of Population Health Sciences
Royal College of Surgeons in Ireland
Beaux Lane House
Dublin 2


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index