Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Selecting the intersection between two sets of macro variable lists

    Hi,

    I want to create a local variable list that is the union of 2 macro variable lists without repeat. Here is an example of what I would like:

    Code:
    global M1 "LogSize DY MOM36"
    global M_crisis_1 "LogSize DY MOM12"
    
    * What i want:
    local union "LogSize DY MOM36 MOM12"
    Thank you in advance!

  • #2
    . global M1 "LogSize DY MOM36"

    . global M_crisis_1 "LogSize DY MOM12"

    . local union : list global(M1) | global(M_crisis_1)

    . display "`union'"
    LogSize DY MOM36 MOM12

    .


    Code:
    help macrolists

    Comment


    • #3
      Many many thanks Joseph!

      Comment


      • #4
        Hi both.

        I just want to clarify that this post is confusing two concepts. The intersection is not the same as the union. The intersection is like a logical "and" and the union is like a logical "or".

        This solution is giving a logical "or", taking items in the first or second global. This is not actually what the subject line is asking for but does appear to be what Francois wanted.

        For those interested, to get the intersection simply use "&" instead of the pipe as you would expect and you'll get the intersection.

        Comment

        Working...
        X