Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Getting variable names in a matrix |

Date |
Fri, 10 Feb 2012 16:53:15 +0000 |

Even if you want a Stata matrix eventually, which is not clear, the fact is that you are trying to do something with Stata matrices which is much, much easier with either Stata variables or Mata matrices. I would back up and re-cast your strategy. Nick n.j.cox@durham.ac.uk schmani@gmx.de 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? * * 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/

**Follow-Ups**:**Re: st: RE: Getting variable names in a matrix***From:*schmani@gmx.de

**References**:**st: Getting variable names in a matrix***From:*schmani@gmx.de

- Prev by Date:
**Re: st: Computing the Gini or another inequality coefficient from a limited number of data points** - Next by Date:
**RE: st: identifying duplicate records** - Previous by thread:
**st: Getting variable names in a matrix** - Next by thread:
**Re: st: RE: Getting variable names in a matrix** - Index(es):