Yes, you can. As you are using version 9, one
standard line of advice is to learn Mata, so
that you do this easily, and much more.
In addition, there are add-ons for Stata's old matrix
language which you are using that address this.
Within the most recent of this trilogy by two hands there is a program
called -matselrc- that should help. Even better than
using it is to look inside the code to see how easy it is.
STB-56 dm79 . . . . . . . . . . . . . . . . . . Yet more new matrix commands
(help matcorr, matewmf, matvsort, svmat2 if installed)
7/00 pp.4--8; STB Reprints Vol 10, pp.17--23
commands to produce a correlation matrix, elementwise monadic
function of another matrix, selected subsets of matrix rows
and columns, vec or vech of a matrix, elements sorted within
a vector, matrix from a vector, and commands to save matrices
STB-50 dm69 . . . . . . . . . . . . . . . . . . Further new matrix commands
(help matdelrc, matewm, matmad, matpow if installed)
7/99 pp.5--9; STB Reprints Vol 9, pp.29--34
collection of new matrix commands providing additional matrix
checking, management, element-wise operators, maximum absolute
difference, and power
STB-39 dm49 . . . . . . . . . . . . . . . . . . . . Some new matrix commands
(help matfunc, varfunc if installed)
9/97 pp.17--20; STB Reprints Vol 7, pp.43--48
collection of new matrix commands; several for explicit matrices
and a few for implicit matrices (i.e., variables)
Nick
n.j.cox@durham.ac.uk
Austin Nichols
> I'm sure there's a more elegant solution, but
> something like this might be easy:
>
> . matrix T= (1,2,3,4\5,6,7,8)
> . di T[2,3]
> 7
> /*oops, I wanted the column third from last,
> not the third column */
> . di T[2,colsof(T)-2]
> 6
dferry
> > The problem is that the results of dfgls for each lag are
> listed in reverse order (i.e., results for lag m are listed
> first and results for lag 1 are listed last). So, the line
> "local T = r[`optlag', 5]" does not grab the right row. Can I
> flip the matrix r around so (or re-sort the rows) so that the
> first row corresponds to the results for lag 1 and the row m
> corresponds to results for lag m? Or is there perhaps a
> better way to approach this?
*
* 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/