Bookmark and Share

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]

Re: st: combining local macros


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: combining local macros
Date   Mon, 11 Apr 2011 12:58:48 +0100

It's doable. I think you just need to crunch through the possibilities.

foreach y of local b {
      foreach x of local a {
               local xy `xy' `x'`y'
      }
}

At first sight this may seem like something that should be provided
explicitly. (If it is, my ignorance or poor memory is revealed.)
Trouble is, it is easy to think of dozens of such little things that
-- when you need them -- strike you in the same way. So, better to
think that a little work with more general tools gets you there
without too much strain.

Nick

On Mon, Apr 11, 2011 at 12:47 PM,  <[email protected]> wrote:
>
> Hello,
>
> Could someone help me out with the following:
> suppose you have
>
> local a x y z
> local b 1 2
>
> and want to create a new local macro from a and b looking like:
> x1 y1 z1 x2 y2 z2
>
> Is this possible?
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index