Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Subsetting a -return- matrix in a single step

From   Bert Jung <>
Subject   st: Subsetting a -return- matrix in a single step
Date   Fri, 10 Sep 2010 17:50:37 -0400

Dear Statalisters,

I would like to subset a -return- matrix.  In the past I used two
steps but now hope to upgrade to the 1-step solution, if it exists?


*** Example: using tabstat just to produce some r(matrix) to play with

tabstat foreign turn weight length headroom, stat(mean sd q) save
return list

mat list r(StatTotal)

*** Say I want the first 3 rows and 2 columns of this matrix.  Can the
following be done in a single step?

mat A = r(StatTotal)
mat A = A[1..3,1..2]

mat list A

*** Obviously this generates a syntax error
mat B = r(StatTotal)[1..3,1..2]
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index