Announcement

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

  • Storing results in Stata

    How can I store result of a command in a separate variable.For example after giving command "corrgram ",how to save AC at lag 1 in a new variable.I request any Stata user to kindly answer to this question.

  • #2
    Doesn't ac , generate() work for you? See the help file for corrgram and take a look at the options for the companion command, ac.

    Comment


    • #3
      Dear Joseph I did'nt understand what you are trying to say.I am talking about any result to store in a separate variable.coorgram was just an example

      Comment


      • #4
        Your question is about "any command". Some commands explicitly put results in new variables.

        For other commands, see http://www.stata.com/manuals13/u.pdf 18.8 and/or help return. In most cases, putting new results in a macro or scalar or matrix is a better idea than using a new variable.

        As a new user, please study http://www.statalist.org/forums/help especially Sections 3, 4 and 6.

        Comment


        • #5
          Dear Nick Cox,Thank you for your suggestions.After reading Stata Manual I was unable to find answer to my question.Will you please elaborate by giving an example?

          Comment


          • #6
            mtaimoor23,
            1) after any command you can explore the saved results in r(), e(), s(). The particular type depends on the type of command: r-class, e-class, s-class. A mix is also possible.
            2) not all commands make available everything they compute internally and/or show to the user; consult documentation for a particular command.
            3) saved results are not available as a single object (if this is what you mean by your question). For estimation commands you can save the results with 'estimates store'.
            Hope this helps, Sergiy Radyakin

            Comment


            • #7
              i have gone through ereturn list command but this is not what I want.I want to save to autocorrelation at lag 1 (AC1) computed from corrgram command so that I can use this result for future analysis.

              Comment


              • #8
                Your question has already been answered more than once in various ways. Joseph pointed you to help corrgram which explains that the first autocorrelation is available in r(ac1).

                Code:
                webuse grunfeld 
                corrgram invest if company==1 
                scalar ac1 = r(ac1)

                Comment

                Working...
                X