Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Sergiy Radyakin <serjradyakin@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: charlist syntax error |
Date | Fri, 28 Feb 2014 15:55:53 -0500 |
Martyn, alternatively there is a [closely] related command -hexstring- by me. See instructions posted here: http://www.stata.com/statalist/archive/2009-11/msg00726.html It handles quotes afaik: // --------------------------------------- clear all set obs 1 generate foo=`"a\`b"c'd\$e"' list, clean noobs hexstring foo, generate(bar) // --------------------------------------- foo a`b"c'd$e // --------------------------------------- Best, Sergiy Radyakin On Fri, Feb 28, 2014 at 8:50 AM, Nick Cox <njcoxstata@gmail.com> wrote: > We've resolved the problem. I'll send a revised -charlist- to Kit Baum > for SSC, but as advertised he's away for a while. > > Thanks to Martyn for his bug report, which prompted a cleaner > rewriting of -charlist-. > Nick > njcoxstata@gmail.com > > > On 28 February 2014 13:14, Nick Cox <njcoxstata@gmail.com> wrote: >> From the output the culprit is evidently the backtick or left >> quotation mark (char(96)). >> >> The occurrence of the character ` (char(96) was problematic for >> -charlist- given its uses for local macro references. >> >> I found in my files a -charlist- 1.2.0 from 2008 which dealt with this >> problem without crashing, but not well. Evidently I never sent that to >> SSC. >> >> I'll send a -charlist- 1.2.1 to Martyn directly to see if that helps >> his problem >> >> Nick >> njcoxstata@gmail.com >> >> >> On 28 February 2014 12:48, Martyn Sherriff <statams48@gmail.com> wrote: >>> I regularly use charlist (SSC NJC 1.1.0 17 Dec 2002 ) to screen data >>> for strings in supposedly numeric data and I am getting a syntax error >>> with the following variable: >>> .d x35 >>> x35 str3 %9s >>> >>> . charlist x35 >>> invalid syntax >>> r(198); >>> >>> I can detect the errant characters: >>> . list x35 if missing(real(x35)) >>> >>> +-----+ >>> | x35 | >>> |----- | >>> 53. | 29n | >>> 63. | 6` | >>> +-----+ >>> >>> I would be grateful if somebody could suggest what I am doing >>> incorrectly with charlist (it works with other variables in the >>> dataset). >>> >>> Stata 13. >>> >>> Thank you. >>> >>> Martyn >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/faqs/resources/statalist-faq/ >>> * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/