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" <[email protected]>
To   <[email protected]>
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 
} 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]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:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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