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
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: RE: numlabel gives syntax error on one specific dataset
Date
Wed, 23 Feb 2011 13:06:09 -0500
Nick, Graham:
Only a few characters can cause problems, and 2 of them are 10 and 13
which I did not deal with in my prior post:
sysuse auto, clear
la def r 1 "`=char(10)'worse" 2 "`=char(96)'bad" 3 `""OK""'
la val rep78 r
ta rep78
foreach var of var rep78 {
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 local v `"`=char(34)'"' "`=char(148)'",all
loc g=subinstr("`g'",char(10),"",.)
loc g=subinstr("`g'",char(13),"",.)
loc g=subinstr("`g'",char(96),char(39),.)
di "`g'"
la def `la' `l' "`g'", modify
}
}
}
numlabel, add force
ta rep78
*
* 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/