help for _mrsvmat

Post-mrtab utility

_mrsvmat [ , stat(statname) rtotal ctotal nopercent nolabel clear ]

where statname is { freq | column | row | cell | rcolumn | rcell }


_mrsvmat can be used after mrtab to create a data matrix from the results left behind (note that the data in memory will be lost). Do not use _mrsvmat unless you are confident that mrgraph does not meet your needs.

Each row of the data created by _mrsvmat will represent one response category. The variables are:

R Values/names of the response categories.

L Labels of the response categories (if available).

C1, C2, ... Frequencies. Each variable represents one column of the two-way frequency table. In the case of one-way tables, just one variable, C1, will be created.

T Row totals (optionally).


clear allows _mrsvmat to clear the data in memory without asking for confirmation.

ctotal specifies that column totals be saved.

nolabel specifies that labels be ignored.

nopercent specifies that relative frequencies be formatted as proportions (.271) rather than percentages (27.1).

rtotal specifies that row totals be saved.

stat(statname) determines the statistic to be saved. statname is either freq for raw frequencies or column (base: column total of observations), row (base: row total), cell (base: grand total of valid observations), rcolumn (base: column total of responses), or rcell (base: grand total of responses) for relative frequencies. stat(freq) is the default.


. use http://fmwww.bc.edu/RePEc/bocode/d/drugs.dta (1997 Survey Data on Swiss Drug Addicts)

. mrtab crime1-crime5, include response(2 3) by(sex) nofreq . preserve . _mrsvmat, stat(column) ctotal rtotal clear . list, clean string(20) R L C1 C2 T > 1. crime1 hit someone 14.46281 14.15663 14.23841 > 2. crime2 use a weapon against.. 1.652893 3.313253 2.869757 > 3. crime3 sexual harassment, r.. 12.80992 0 3.421633 > 4. crime4 robbery (including d.. 13.22314 9.939759 10.81678 > 5. crime5 blackmail 5.785124 2.108434 3.090508 > 6. T Total 47.93388 29.51807 34.43708 >

. generate x=_n . scatter C1 C2 x in 1/5, xtitle(Type of crime) ytitle(Percent) title(Criminal experiences (as a victim))


Ben Jann, ETH Zurich, jann@soz.gess.ethz.ch

Also see

Manual: [P] matrix mkmat