Bookmark and Share

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


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

st: How to create a blank n x n matrix; how to refer to variables without using ID; how to extract colnames and rownames from the dataset.


From   "Chen, Xianwen" <[email protected]>
To   [email protected]
Subject   st: How to create a blank n x n matrix; how to refer to variables without using ID; how to extract colnames and rownames from the dataset.
Date   Wed, 9 Mar 2011 13:42:53 +0100

Hi there,


I'm new to Stata and having been googling for following three
questions for more than an hour. I hope you can give me a hint.


The first question is a fast way to create a n x n matrix. For
example, to create a 8 x 8 matrix for later data manipulation. What I
now do is to create a matrix by
  matrix define mat1=vect1,vect1,vect1,vect1,vect1,vect1,vect1,vect1
where vect1 is a 8x1 matrix

Is there a better way of doing it? For example, something like
  matrix define mat1={1:8,1:8}


The second question is regarding variables. I want to search through
the variables by each entry of the data. I can specify the column IDs
but I want a more automated solution.

Is there a way of working with it, say
  somefunction{1,}
will actually refer to the first column of the dataset?


The third question is to extract colnames and rownames from the
datasets. Is there a function I can use?


I'm sorry for bombing all question all together in an email if it
doesn't fit the netiquette here. I just don't want to send three
questions in three mails, which may be annoying.

Xianwen
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index