Announcement

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

  • Copy global to local

    How can I copy all elements from a global to a local? This did not work

    Code:
    global cov gender age age2
    local cov : copy local `"$cov"'
    disp "`cov'"

  • #2
    Code:
    . global cov gender age age2
    
    . local cov $cov
    
    . display `"`cov'"'
    gender age age2

    Comment


    • #3
      The following shows how to accomplish this using the macro copy command, since that guarantees that the macro contents are not interpreted by the Stata command line interpreter.
      Code:
      . global cov gender age age2
      
      . local cov : copy global cov
      
      . disp "`cov'"
      gender age age2
      
      .

      Comment

      Working...
      X