help mmat (User-written stata packages: mtab)

Title

mmat -- Extract the results from an existing matrix to a new matrix

Syntax

mmat
namelist
[, options
]

namelist indicates name of the original matrix, which is highly recommended to be named as a capital letter for example A, K, T etc. except for the capital letter B.

Options
Row indicates the list of rows in the original matrix that should be extracted to a new matrix.

Col indicates the list of columns in the original matrix that should be extracted to a new matrix.

Description

Command mmat Extract the results from an existing matrix to a new matrix.

Options

col specify a list of rows that should be extracted to a new matrix.

col specify a list of columns that should be extracted to a new matrix.

Examples

1. make up a matrix

.mat X=(1,2,3,4,5,6\7,8,9,10,11,12\13,14,15,16,17,18\19,20,21,22,23,24)

.mat list X

2. Extract the rows (1 2 3) and columns (3 4 5)

.mmat X, r(1/3) c(3/5)

3. Extract the rows (1 3) and columns (3 5)

.mmat X, r(1 3) c(3 5)

4. Extract all from the fifth column

.mmat X, r(1/4) c(5)

5. Extract all from the thrid row

.mmat X, r(3) c(1/6)

More examples

click on her

Author

Chunsen Wu, the University of Southern Denmark; Odense University Hospital, Denmark

cwu@health.sdu.dk

chunsen.wu@rsyd.dk

Also see

Help: mtab, mtab1, mtab2, msum, mest, mexcel, and mobs