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: Creating object names in Mata through looping


From   Pedro Nakashima <nakashimapedrolist@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Creating object names in Mata through looping
Date   Fri, 28 Dec 2012 23:58:21 -0200

Dear Stata users

I'm looking for a way to create object names in Mata through looping.

For example:

capture program drop progby1
program progby1, byable(recall,noheader)
local inicio = _byn1()
local fim   = _byn2()
local rodada = _byindex()
local in "`inicio'/`fim'"
display "`in'"
mata: funcao2(`inicio',`fim',`rodada')
end

mata
void funcao2(real scalar inicio,real scalar fim,real scalar byi)
{
d=st_data((inicio::fim),("var1","var2"))
d
}
end

I would like that the matrix d of the function funcao2 had varying
names, depending on the value of argument byi

Does anyone know a solution to this problem?

Thank you..
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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