Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Getting variable names in a matrix

Subject   st: Getting variable names in a matrix
Date   Fri, 10 Feb 2012 14:24:33 +0100

Hey all,

for my analysis I am generating a matrix for each of 385 formation periods that includes the cumulated return of stocks (named return_v2-return_v1399)

I now want to sort this matrix in order to obtain the highest X% of returns to continue my research. However, everytime I sort the matrix, the rownames get lost and I hence do not know which asset achieved which return.

Is it possible to add an additional row that contains the name of the variable to the matrix? I have experimented with "describe, simple", but did just generate errors. 

Here is the generation of the matrices:

forvalues i = 1(1)385 {

	mkmat return_v2-return_v1399  in `i', matrix(formation_`i')
	matrix rownames formation_`i' = return_v2-return_v1399

I want to have a matrix that looks like this:
( 0.2  0.5  0.71 ...)
( v3   v7   v500 ...)   So how can I obtain the variable names?

Best regards,
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro!
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index