Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Converting variables to a matrix

From   "Nick Cox" <>
To   <>
Subject   st: RE: Converting variables to a matrix
Date   Fri, 14 May 2004 17:09:15 +0100

This should work if the string values
are acceptable as row names: 

sysuse auto
gen M = word(make,1) 
replace M = subinstr(M, ".","",.) 
mkmat mpg weight, matrix(A) 

forval i = 1/`=_N' { 
	matname A `=M[`i']', row(`i') explicit 


> -----Original Message-----
> From:
> []On Behalf Of Faye Turner

> How do I tell STATA to use the first column (a string variable) of my 
> dataset as the row names when converting variables to a matrix?

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index