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

  • Saving ST cox results to a tempfile

    I am trying to create a forest plot with hazard ratios for several sub groups.

    I want to be able to save the hazard ratio and confidence intervals after running st cox to a tempfile

    I have previously done something similar with odds ratios by using cs command then post `oddsratio' (`r(or)') (`r(ub_or)') (`r(lb_or)') saving the scalers

    after I run stcox the values do not appear when I type in return list

    so my question is how do I find and specifiy the values so I can save them to my temp file



  • #2
    Everything that is shown in the regression output table is also stored in a matrix r(table). So you can grab that in a real matrix and then access the relevant elements of the matrix for your -post- command.

    By the way, this is true of all official Stata estimation commands.


    • #3
      Clyde Schechter This was news to me, although given my memory, it may have been news to me in the past as well.

      We can perhaps agree that it is unfortunate that Stata's documentation for individual estimation commands includes only the e-class returned results, and not the other returned results, nor even a hint as to their existence. And I for one can never remember the help topic, or perhaps its only available in the full manual PDF, that discusses this, as well as _b and _se and other bits and pieces estimation commands leave behind. It certainly isn't help estimation although I think it ought to be, and the individual commands should link to that in their "Stored results" section.


      • #4
        I agree. I don't know where one might find this in the documentation. As I recall, the r(table) mechanism was introduced with one of the version upgrades of Stata, maybe around Stata 12? I read about this in the -help whatsnew- that inaugurated that version. The only other place I've seen it is here on Statalist, where it's been mentioned a few times.

        More generally, one improvement I would like to see in Stata's documentation is including what is returned in r() in the help file for every command. Some help files have it; some do not.