Announcement

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

  • "sts graph, risktable() saving()" tries (and fails) to save graph-file twice

    Hi all,

    I've come across some unexpected behaviour which I'd appreciate comments on. I'm using Stata 15.1 on Windows 7.

    Code:
    webuse drug2, clear
    
    // sts graph without risktable: successful
    sts graph, by(drug) saving(testgraph1.gph)
    
    // sts graph without risktable: exits with error r(602)
    sts graph, by(drug) risktable saving(testgraph2.gph)

    It appears that the code for the "risktable" subroutine causes "sts graph" to attempt to save the graph twice, the second such attempt failing as would be expected.

    This can of course be worked around by saving the graph in a separate command line; but to me this is nevertheless a bug.

    Thanks,

    David.
    Last edited by David Fisher; 27 Mar 2019, 09:51.

  • #2
    This happens with StataMP 15.1 on a Mac, too.

    David is right: sts graph saves the graph twice (with the same name). This becomes apparent when adding the replace option to saving().

    Code:
    . sts graph, by(drug) risktable saving(testgraph2.gph, replace)
    
             failure _d:  died
       analysis time _t:  studytime
    (file testgraph2.gph saved)
    (file testgraph2.gph saved)

    Comment

    Working...
    X