The name is absent



Stata Technical Bulletin


STB-20


. disp_s
S_l:

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. From Communication to Presence: Cognition, Emotions and Culture towards the Ultimate Communicative Experience. Festschrift in honor of Luigi Anolli
2. Palkkaneuvottelut ja työmarkkinat Pohjoismaissa ja Euroopassa
3. THE INTERNATIONAL OUTLOOK FOR U.S. TOBACCO
4. The name is absent
5. WP 48 - Population ageing in the Netherlands: Demographic and financial arguments for a balanced approach
6. Innovation and business performance - a provisional multi-regional analysis
7. Human Development and Regional Disparities in Iran:A Policy Model
8. The name is absent
9. Constrained School Choice
10. Database Search Strategies for Proteomic Data Sets Generated by Electron Capture Dissociation Mass Spectrometry