DOI: 10.1177/1536867x231212439 ISSN: 1536-867X

Improving flexibility and ease of matrix subsetting: The submatrix command

Daniele Spinelli
  • Mathematics (miscellaneous)

Matrix manipulation in Stata can be a time-consuming and tedious task, especially when it is necessary to subset or rearrange elements from large matrices based on nonconsecutive elements. Compared with Mata, these tasks require more time, more code, and sometimes more complex output. The purpose of this article is to introduce submatrix, a command to manipulate matrix elements using row (and column) names, numbers, and equations.

More from our Archive