Statalist


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

Re: st: Local with Global macro lists


From   "Sergiy Radyakin" <[email protected]>
To   [email protected]
Subject   Re: st: Local with Global macro lists
Date   Tue, 5 Feb 2008 15:53:52 -0500

Here is what you have:

- global N = 1
- local Var$Nvs$N "(g${N}vs${N} : -("
= local Var1 "(g1vs1 : -("
- local one "x + y))"
- local Var${N}vs${N} "`Var${N}vs${N}' `one'"
= local Var1vs1 " x + y))"
- di "Var${N}vs${N} is  `Var${N}vs${N}' "
= di "Var1vs1 is   x + y)) "
Var1vs1 is   x + y))

Here is what you wanted:

- global N = 1
- local Var${N}vs${N} "(g${N}vs${N} : -("
= local Var1vs1 "(g1vs1 : -("
- local one "x + y))"
- local Var${N}vs${N} "`Var${N}vs${N}' `one'"
= local Var1vs1 "(g1vs1 : -( x + y))"
- di "Var${N}vs${N} is  `Var${N}vs${N}' "
= di "Var1vs1 is  (g1vs1 : -( x + y)) "
Var1vs1 is  (g1vs1 : -( x + y))


Best, Sergiy



On 2/5/08, Valerie Orozco <[email protected]> wrote:
> Hi,
>
> I have a  problem with macros.
> I'm using global macro in some local ones and what I want to obtain don't work…if someone has an idea.
>
> Example without global macro (which works) :
>
> local Var1vs1 "(g1vs1 : -("
> local one "x + y))"
> local Var1vs1  "`Var1vs1' `one'"
> di "Var1vs1  is `Var1vs1' "   /*it works, I have : Var1vs1  is (g1vs1 : -( x + y)) */
>
> Example with global macro (doesn't work) :
>
> global N = 1            /*here is my global*/
>
> local Var$Nvs$N "(g${N}vs${N} : -("
> local one "x + y))"
> local Var${N}vs${N}  "`Var${N}vs${N}' `one'"
> di "Var${N}vs${N} is  `Var${N}vs${N}' "   /*Problem I have:Var1vs1 is   x + y)) */
>
> I try to use this sort of program in order to use the nlcom command with a lot of elements…
>
> Thank you very much.
>
> valérie
>
> -------------------------------
> Valérie OROZCO
> Toulouse School of Economics (INRA-GREMAQ)
> 21, allée de Brienne
> F-31000 Toulouse, France
>
> MF 426
> +33 5 61 12 85 91
> -------------------------------
>
>
> *
> *   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/
>

*
*   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