Stata Technical Bulletin
STB-20
. disp_s |
7 |
S_2: |
1 |
S_3: |
1994 |
S_4: |
Sat. |
Note that today did not mistakenly put “Sat.” in S_4. today happens to use only S_l-S_3, leaving S_4 from the lastday
command.
ip6 Storing variables in vectors and matrices
Ken Heinecke, Federal Reserve Bank of Kansas City, FAX 816-881-2199
mkmat takes the variables listed in varlist and stores them in column vectors; that is, N × 1 matrices where N = _N, the
number of observations in the data set. The syntax of mkmat is
mkmat varlist [if exp] [in range] [, matrix (mataame) ]
If the matrix() option is specified, the vectors are also combined in a matrix.
Discussion
Although it is possible to load variables into a matrix using the matrix accum command, programmers may find it more
convenient to work with the variables in their data sets as vectors instead of as cross products. mkmat allows the user a simple
way to load specific variables into matrices in Stata’s memory.
Example
. describe
Contains data from test.dta
Obs: 10 (max= 2562)
Vars: 3 (max= 200)
Width: 12 (max= 402)
1. x float 7,9.0g
2. y float 7,9.0g
3. z float 7,9.0g
Sorted by:
. list
x |
У |
z | |
1. |
1 |
10 |
2 |
2. |
2 |
9 |
4 |
3. |
3 |
8 |
3 |
4. |
4 |
7 |
Б |
Б. |
Б |
6 |
7 |
6. |
6 |
Б |
6 |
7. |
7 |
4 |
8 |
8. |
8 |
3 |
10 |
9. |
9 |
2 |
1 |
10. |
10 |
1 |
9 |
. mkmat y z
. matrix list y
y[10,l]
У
rl 10
r2 9
r3 8
r4 7
гБ 6
гб Б
г7 4
г8 3
г9 2
rlθ 1
. matrix list z
More intriguing information
1. The East Asian banking sector—overweight?2. Non-farm businesses local economic integration level: the case of six Portuguese small and medium-sized Markettowns• - a sector approach
3. The name is absent
4. The name is absent
5. Survey of Literature on Covered and Uncovered Interest Parities
6. Life is an Adventure! An agent-based reconciliation of narrative and scientific worldviews
7. The name is absent
8. The name is absent
9. Computational Batik Motif Generation Innovation of Traditi onal Heritage by Fracta l Computation
10. Backpropagation Artificial Neural Network To Detect Hyperthermic Seizures In Rats