Announcement

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

  • How to list all locals and store them in a macro?

    Stata can store all globals in a macro via "local globals: all globals"

    It can also print all globals and locals via "macro dir" (locals are globals that start with "_").

    However, I am struggling to find a way it can list all locals and store them in a variable, similar to ":all globals" (":all locals" and ':all globals "_*"' did not work).

  • #2
    Code:
    mata : st_local("all_locals", invtokens(st_dir("local", "macro", "*")'))
    display "`all_locals'"
    Best
    Daniel

    Comment


    • #3
      Beautiful. Thanks!

      Comment

      Working...
      X