Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Filling a matrix


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Filling a matrix
Date   Tue, 15 Apr 2003 09:31:41 +0100

Graeme Inglis

> I have a 1500x1 matrix and want to create a 1500 x 50 
> matrix where the 50
> columns are identical and a repeat of col 1.
> Later I want to create another matrix of duplicated rows.
> I can't find the Stata command to do these manipulations. 

Assuming that A is an appropriate vector, 
and that -matsize- is not limiting, you 
can copy columns by 

forval i = 1/50 { 
	mat B = nullmat(B) , A 
}

and rows by using \ instead of ,. 

Nick 
n.j.cox@durham.ac.uk 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index