Announcement

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

  • How to return a list into local variable within a program

    Hi Stata,

    How can I return a list into a local variable within a program? See example below
    I am defining a program.do file and run the programs in a main analysis do file
    I come from R, so I apologise in advance if this is a stupid question for STATA.


    Code:
    program list_generator
        arg myfilter
    
       qui levelsof myvariable if filtervariable == `myfilter', local(mylist)
    
       return mylist // here i don't know how to pass the local back to the main script
       end


  • #2
    -help return- reveals and describes the -return local- command, which likely will do what you want.

    Comment

    Working...
    X