Statalist


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

st: How to do a basic task in MATA that I cannot explain in English


From   "Tiago V. Pereira" <[email protected]>
To   [email protected]
Subject   st: How to do a basic task in MATA that I cannot explain in English
Date   Tue, 6 Jan 2009 13:57:43 -0200 (BRST)

Thanks a lot to Kit, Nick and Sergiy for their insighfull comments on my
recent question!

Tiago


Dear statalisters,

Although I know how to create basic Stata commands, I have no idea how to
express some tasks that I am trying to do in technical terms (in English).
Hence, I believe that showing one example will be the most straightforward
manner to make myself clear.

I have just started to play with some Mata lines, and would like to know
if it is possible to add something that does the same role of `i' in Stata
programming.

For example:


forvalues i = 1/100 {
matrix TEST_`i' = (`i',43,500)
}


will create 100 vectors/matrices: TEST_1..TEST_100

Taking the simple lines below, is it possible to create matrices TEST_1 to
TEST_100 too?


*/-----------------START--------------

clear
set obs 100
gene MATA = round(uniform()*45)
gene RULES = round(uniform()*15)
mata
X = st_data(.,("MATA", "RULES"))
Y = st_data(.,("RULES", "MATA"))
for (i=1; i<=100; i++) {
TEST = X[i,1]\Y[i,1]\X[i,1]\Y[i,1]
}
end
*/-----------------END-----------------


Cheers!

Tiago










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