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. Firm Closure, Financial Losses and the Consequences for an Entrepreneurial Restart2. The name is absent
3. A Regional Core, Adjacent, Periphery Model for National Economic Geography Analysis
4. Top-Down Mass Analysis of Protein Tyrosine Nitration: Comparison of Electron Capture Dissociation with “Slow-Heating” Tandem Mass Spectrometry Methods
5. The name is absent
6. The Impact of Cognitive versus Affective Aspects on Consumer Usage of Financial Service Delivery Channels
7. The name is absent
8. The name is absent
9. Imitation in location choice
10. MULTIPLE COMPARISONS WITH THE BEST: BAYESIAN PRECISION MEASURES OF EFFICIENCY RANKINGS