> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of David Elliott
> Sent: Wednesday, October 04, 2006 4:45 PM
> To: [email protected]
> Subject: st: Behaviour of -tokenize- shouldn't it drop the parsing
> character?
>
> I want to tokenize groups of numbers separated by the "|" character:
> e.g.: 1 2 3 | 4 5 6| 7 8 | 9 so that I have each group in a positional
> macro
> _1 = 1 2 3, _2 = 4 5 6 ... However, I have found that tokenize does
> not behave as I expected.
I misread what the actual problem was. Here is one way to get the space
separated positional macros:
local test 1 2 3 | 4 5 | 6 7 8 | 9
local test : subinstr local test " " ",", all
local test : subinstr local test "|" " ", all
local count : word count `test'
tokenize "`test'"
forv i = 1/`count' {
local `i': subinstr local `i' "," " ", all
}
mac dir
Scott
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/