True enough, but if you're cycling over a numlist 1/`r'
you might as well translate this directly to
inspect `2'
local r=`r(N_unique)' - 1
forval v = 1/`r' {
matrix C[`v',1]=c`v'
}
and then this is a smidgen cleaner:
inspect `2'
local r = r(N_unique) - 1
forval v = 1/`r' {
matrix C[`v',1] = c`v'
}
and this is a smidgen shorter still,
although perhaps more difficult to read:
inspect `2'
forval v = 1/`= r(N_unique) - 1' {
matrix C[`v',1] = c`v'
}
But the code is all followed by a -matrix list C-.
And those -c1-, -c2-, etc. are presumably scalars,
that must exist already. So I don't understand this
really, I am just translating code.
Nick
[email protected]
P.S. I guess the -nostop- would be translated
by a -capture- somewhere.
Abdel Rahmen El Lahga
>
> inspect `2'
> local r=`r(N_unique)' - 1 // maxt is ignored
> foreach v of numlist 1/`r' {
> matrix C[`v',1]=c`v'
> }
> ltype(numeric) is to tell Stata that the cooresponding list is numeric
> not varlist
> nostop tell Stata to not stop the loop even if there are an error but
> i don't know to deal with this option
> HTH
> AbdelRahmen El Lahga
> 2007/6/22, Raphael Fraser <[email protected]>:
> > An additional question:
> >
> > inspect `2'
> > local maxt=`r(N_unique)'
> > local r=`maxt'-1
> > for 1-`r', ltype(numeric) nostop: matrix C[@,1]=c@ /* <--
> Convert to
> > Stata 9 code */
> > matrix list C
*
* 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/