[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: -charlist- revised on SSC; question about -*trim()-
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
. 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
StataCorp may have a comment.
* For searches and help try: