Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Getting variable names in a matrix


From   schmani@gmx.de
To   statalist@hsphsun2.harvard.edu
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,
Daniel
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index