Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: RE: numlabel gives syntax error on one specific dataset
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
RE: st: RE: numlabel gives syntax error on one specific dataset
Date
Wed, 23 Feb 2011 17:19:56 +0000
No; it's the dataset. It's a fairly scary set of label definitions if the total number of characters exceeds 1 million.
But we are talking about the same underlying problem, I believe.
Nick
[email protected]
Austin Nichols
Nick--
Is that -hexdump- output reporting on the contents of labels? It is
easy to break -numlabel- with some odd characters in labels:
sysuse auto, clear
la def r 1 "poor" 2 "`=char(96)'fair" 3 "OK" 4 "good" 5 "superb"
la val rep78 r
ta rep78
numlabel, add force
ta rep78
But one can strip out all the weird characters from all the labels...
foreach var of var _all {
loc la: val lab `var'
if "`la'"!="" {
qui levelsof `var', loc(ls)
foreach l of loc ls {
loc v: label `la' `l'
loc g=subinstr("`v'",char(96),"",.)
forv h=123/255 {
loc g=subinstr("`g'",char(`h'),"",.)
}
la def `la' `l' "`g'", modify
}
}
}
On Wed, Feb 23, 2011 at 10:03 AM, Nick Cox <[email protected]> wrote:
> I said that Graham could send a copy to me. I confirm that I get his error message with his data. Looking at the labels there are some unprintable characters in his labels. So, I think he's right. It's a problem with his data.
>
> The error message, by the way, emanates from inside -matalabel-, but tracing it didn't seem the major part of valour.
>
> ASCII-fluent experts can perhaps ascertain [good word, isn't it] what may be alien from the results of -hexdump, tabulate-.
*
* 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/