Announcement

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

  • advice on using putexcel command to export sts list and sts graph data to excel.

    Hi, I am new to Stata and would really appreciate a little guidance. I am using Stata 14 on Mac OS 10.12. I am performing a kaplan-meier survival analysis on a dataset, mainly using the sts list command and I want to use the putexcel command to export the results into excel as I would like to create the graphs in excel (easier to format in powerpoint) and also because some colleagues don't have Stata so this would a helpful way to share results. I have looked for answers online and from Stata manuals too, but cannot find the solution - mainly because I don't fully understand what I am reading! If someone can point me in the right direction I would be very grateful. Thank you.

  • #2
    Welcome to Statalist, James.

    I do not have direct experience with the sts commands, but after looking over the documentation briefly, it seems to me that something along the following lines will accomplish what you need.
    Code:
    webuse stan3, clear
    stset, noshow
    sts list, saving(stsresults, replace)
    use stsresults, clear
    export excel using stsworkbook, sheet("STS results") sheetreplace
    The first five rows of the sts list results:
    Code:
               Beg.          Net            Survivor      Std.
      Time    Total   Fail   Lost           Function     Error     [95% Conf. Int.]
    -------------------------------------------------------------------------------
         1      103      1      0             0.9903    0.0097     0.9331    0.9986
         2      102      3      0             0.9612    0.0190     0.8998    0.9852
         3       99      3      0             0.9320    0.0248     0.8627    0.9670
         5       96      1      0             0.9223    0.0264     0.8507    0.9604
       5.1       95      1      0             0.9126    0.0278     0.8388    0.9535
    And the first five rows in the workbook:

    1 103 1 0 0.990291262 0.009661493 0.933083747 0.998626666
    2 102 3 0 0.961165049 0.019036704 0.899836971 0.985244875
    3 99 3 0 0.932038835 0.024798693 0.86272977 0.967008703
    5 96 1 0 0.922330097 0.026372479 0.850693703 0.960379931
    5.099999905 95 1 0 0.912621359 0.027824627 0.838812028 0.953549691

    Comment


    • #3
      Thank you, William - this is very helpful indeed!
      I've had a play using my dataset and I think this method will work very well.
      Thanks also for your quick response - I really appreciate it.
      Kind regards,
      James

      Comment

      Working...
      X