Announcement

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

  • Using Global Macro in another do-file

    Dear Stata Experts,

    I have a global macro g2 in program1, it looks like that:

    Code:
    . di "${g2}"
    function y = 80.98921259870659 + -.008561077824043*x + 5.62491844330e-07*x^2
    I would like to use it in program2, which is another dataset opened with another do-file. When I type the same command to show me the macro i get nothing:

    Code:
    . di "${g2}"
    Both dta-files are being open. I also tried to first run program1 and only after that program2, nothing works.
    Why?

    Another question: is it possible to use global macro g2 in program2, once program1 is closed?

    Sincerely,

    Pavlo

  • #2
    That should work in the way that you wish. A global macro should be visible anywhere once it has been defined. That is the point (and the problem...).

    The {} are redundant but should not be problematic.

    Comment

    Working...
    X