Announcement

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

  • how can I use the results of one program in another program

    Hi all:

    I am a new user of Stata programming and I met some difficulty in ado file programming.

    I have written an ado-file, which I want to use repetitively in later programming process. I return some of the values in this ado file but I have no idea how to retrieve this value in another program. For example,
    program prog1

    return p75 = r(p75)
    return p25 = r(p25)
    end
    Then how can I use the scalar p75 in another program?
    For example,
    program prog2

    scalar a = p75 + p25

    end

    Thank you so much!!!

  • #2
    Hi Ingrid
    I think you're in the wrong fora. This is for Mata, not Stata.
    However if you study the following codeblock you might get an idea on how to proceed:
    Code:
    capture program drop func
    program define func, rclass
        args x    
        return scalar p75 = `x' + 5
    end
    
    func 4
    display r(p75)
    Kind regards

    nhb

    Comment


    • #3
      Hi Bruun,

      Thank you for your reply! I guess I have been confused with Mata and Stata. Thank you for your patience and kind help.

      Best regrad,
      Ingrid

      Comment

      Working...
      X