*! version 1.0 Jul2016
help rcolp2mat

Syntax

rcolp2mat
varname1
varname2
[if] [in]
[weight]
,
matrix(matname)
row col
[options]

required

matrix(matname) indicate name of matrix for saved results

row col create row or column percentages. Only one selection allowed

optional

total add row with total % (cannot be used with detail)

detail add row and column Ns (cannot be used with total)

missing treat missing values like other values

Description

rcolp2mat produces a two-way table with row or column percentages and saves results in a matrix with appropriate labels. Saved matrix can easily be exported to excel (see putexcel).

Examples

. sysuse nlsw88.dta

. rcolp2mat race union, matrix(A) row

. rcolp2mat race union, matrix(A) row total

. rcolp2mat race union, matrix(A) col detail

. rcolp2mat race union, matrix(A) col total missing

Author

Loris P. Fagioli, Irvine Valley College, CA
lfagioli@ivc.edu

Acknowledgement

The subroutine -matcrename- in this program is based on Nick Cox's code and can be found here