Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: gettoken -- bug?


From   "Ben Jann" <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: gettoken -- bug?
Date   Mon, 8 Sep 2008 21:35:39 +0200

Double quotes always mark off a token, as far as I know. Example:

. local list `""a"b"'

. macro dir _list
_list:          "a"b

. gettoken one two : list

. macro dir _one _two
_one:           a
_two:           b

If this is not documented, I guess it should.

If you want to prevent this, you can use the -quotes- and -qed()-
options and then do some checks and put stuff together again if
necessary.
ben


On Mon, Sep 8, 2008 at 9:10 PM, Johannes Schmieder <jfs2106@columbia.edu> wrote:
> Hi,
> Can someone tell me whether this is intended behavior or a bug in
> Stata (V10, SE Intercooled):
>
> . local list `" "a b" c , d "'
> . macro dir  // omitting the system macros
> _list:           "a b" c , d
> _one:           `"hello.dta"'
>
> . gettoken one two : list , p(",")
> . macro dir
> _two:            c , d
> _one:           a b
> _list:           "a b" c , d
>
> Shouldn't the local "one" contain:  "a b" c
> rather than just: a b
>
> If this is intended behavior this is not well documented in the help
> file or the manual. I realize the first technical note in the manual
> recommends to include " " as a parsing character, but this still seems
> to be strange and not in line with the documentation.
>
> Johannes Schmieder
> *
> *   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/
>
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index