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: Using loop in Mata?
From
Henk-Wim de Boer <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: Using loop in Mata?
Date
Tue, 9 Jul 2013 10:11:05 +0200
Hello everyone,
I am using Mata and I want to put the following code into a loop:
U_1 = colshape(U_1,6)
U_2 = colshape(U_2,6)
U_3 = colshape(U_3,6)
U_4 = colshape(U_4,6)
U_5 = colshape(U_5,6)
U_6 = colshape(U_6,6)
U_7 = colshape(U_7,6)
U_8 = colshape(U_8,6)
U_9 = colshape(U_9,6)
U_10 = colshape(U_10,6)
In STATA, I would use a local variable:
forvalues r=1(1)10 {
gen U_`r' = ....
}
Obviously, this does not work in MATA. Does anyone know how to code this in a proper way in MATA?
Kind regards.
Henk-Wim
--
================================================================================
Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet
de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt
u verzocht dat aan de afzender te melden en het bericht te verwijderen.
De Staat aanvaardt geen aansprakelijkheid voor schade, van welke aard ook, die
verband houdt met risico's verbonden aan het elektronisch verzenden van
berichten.
This message may contain information that is not intended for you. If you are
not the addressee or if this message was sent to you by mistake, you are
requested to inform the sender and delete the message. The State accepts no
liability for damage of any kind resulting from the risks inherent in the
electronic transmission of messages.
================================================================================
*
* 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/