Daniel Egan started a thread by publicising 
a dataset in which a string variable that 
"should have been" numeric contained hard-
to-detect non-numeric characters. 
He eventually fixed his problem by editing 
the original data file within a text editor. 
He tried using, among others, the program 
-charlist- from SSC, but did not find it helpful. 
I then explained what had happened: the problem 
arose from occurrences of the non-breakable space, 
in Stata terms -char(160)-, which is hard to 
see when displayed at the end of a string. 
-charlist- had reported the occurrences nevertheless. 
What I have done is revise the help file for 
-charlist- adding and explaining this very 
interesting and instructive example. Kit Baum 
kindly replaced the file on SSC. You can 
install or replace -charlist- by 
. ssc inst charlist 
or 
. ssc inst charlist, replace 
Stata 7 is required, as previously. 
This leaves an open question about -trim()-. 
In both Stata 8 and Stata 9, something like 
. gen foo = "foo" + char(160) 
adds a character that -trim()- won't remove. 
. replace  foo = subinstr(foo, "`=char(160)'", "",.) 
will do it. But I'm tempted to regard it as a limitation
of -trim()- that it won't remove -char(160)-. 
-ltrim()- or -rtrim()- raise the same issue. 
On the other hand, Daniel's report is the first 
and only report of a problem I can recall of this 
kind. 
StataCorp may have a comment. 
Nick 
[email protected] 
*
*   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/
*
*   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/