Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: using macrolists in constraints


From   Val�rie Orozco <[email protected]>
To   [email protected]
Subject   st: using macrolists in constraints
Date   Fri, 14 Sep 2007 11:47:54 +0200

Hi,

In order to write some constraints (to be used in a model), I would like to use loops and macrolists whereas writing each constraint one after one.
But it seems I am wrong using the following code :

forvalues i = 1/3{
local all "[dw`i']dlnp1"
forvalues j = 2/4 {
local add "+"
local element "[dw`i']dlnp`j'"
local all `"`all' `add'"'
local all `"`all' `element'"'
}
di "`all'"
constraint `i' `all' = 0
}

What I would like is :

constraint 1 [dw1]dlnp1 + [dw1]dlnp2 + [dw1]dlnp3 + [dw1]dlnp4 = 0
constraint 2 [dw2]dlnp1 + [dw2]dlnp2 + [dw2]dlnp3 + [dw2]dlnp4 = 0
constraint 3 [dw3]dlnp1 + [dw3]dlnp2 + [dw3]dlnp3 + [dw3]dlnp4 = 0

Thank you very much for trying to help me.

--
*******************************************************
Val�rie Orozco
Toulouse School of Economics (GREMAQ-INRA)
Universit� des Sciences Sociales, Manufacture des Tabacs
Aile J-J Laffont - 4�me �tage
21, All�e de Brienne - 31000 TOULOUSE - FRANCE
+ 33 5 61 12 85 91
ou + 33 5 61 28 50 97
*******************************************************


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