Dear all,
For a program, I want to input a numerical list into a matrix.
I want to store the list in a local so that I can modify it easily. Namely,
I'm looking at something like:
local nlist "10(5)90 91(1)99 99.1(0.1)99.9 99.91(0.01)99.99"
but then, if I use:
tokenize "`nlist'"
and try to see if i'm doing the right thing by:
di `1'
i get an invalid syntax error.
Furthermore, I'm not sure how to get the size of the numlist so that I can
initialize my matrix with:
matrix A = J(1, size_of_numlist, 0)
Can anyone give me some suggestions?
Radu needs to use the Stata command -numlist- (type -help nlist- in Stata).
-numlist- expands an abbreviated numerical list like Radu's (with brackets)
into a full numerical list, which is saved in the macro result
-r(numlist)-, which can be handled by -tokenize- or -gettoken-. The
following sequence demonstrates the -numlist- command: