Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



If you tokenize into two or more macros, you lose any spaces between them. If you put them back together without spaces, as I understood you to recommend earlier, and as is recorded in your posting, you may run them together: 

. tokenize "frog toad"

. di "`1'`2'"
frogtoad

In the context of this thread, you may run together a subcommand and some other stuff, thus creating garbage. Thus "regress other stuff" is likely to become 

regressother stuff

I use -tokenize- here, but as said the point is wider. 

Nick 
[email protected] 

Sergiy Radyakin

Hi, Nick,

I am not sure what can be good about it. A space that separated subcmd
from the rest remains with the rest anyways and adding another will
double it:
local 0 `"foo "bar""'

. gettoken subcmd 0: 0

. di `"[`0']"'
[ "bar"]

. local 0 `subcmd' `0'

. di `"[`0']"'
[foo  "bar"]

Regards, Sergiy


On Mon, Mar 9, 2009 at 6:14 AM, Nick Cox <[email protected]> wrote:

> An extra space will do no harm and might do good.
>
> local 0 `subcmd' `0'
>
> Nick
> [email protected]
>
> Sergiy Radyakin
>
> after -gettoken- the local `0' does not contain `subcmd' anymore, so
>
> 1) just put it back there:
>
> gettoken subcmd 0: 0
> local 0 `"`subcmd'`0'"'  // <<<---- new line
> if ....
>
>

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index