Announcement

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

  • Error message "No graph window open" using graph export

    Dear Statalist,
    first of all, Happy New Year.
    I have the following problem.
    When I run the dstat command at the bottom with the two different restrictions (1.over(nat) 2. over(fd)), I receive a result for the first use of dstat, but for the second one, I get an error message: No graph window open.
    Not sure, the funny thing is that I ran before without issues, and out of the blue I have these problems.
    Would greatly appreciate your help.
    Thanks,
    Nico

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(match2 female) byte(foreign1 foreign2 foreign3) int age float(rhw nat) long pidp float fd
    2 0 0 1 0 38 4.5327373 1  204551499 1
    3 0 0 1 0 38 10.405592 1  341901971 1
    2 0 1 0 0 64 12.265182 0 1157174371 0
    3 0 1 0 0 62  7.749895 0  544265207 0
    3 0 0 0 1 22  6.573256 2 1512313290 0
    2 0 1 0 0 56 16.995384 0  477004371 0
    2 0 1 0 0 53  6.888796 0  749025451 0
    3 0 1 0 0 58  6.815005 0  816975807 0
    2 0 0 1 0 34  7.581566 1 1378319290 1
    2 0 1 0 0 59  7.698229 0 1224341367 0
    1 0 1 0 0 60  7.644697 0 1224754815 0
    2 0 1 0 0 19  7.380852 0 1156792895 0
    2 0 0 0 1 38   8.21476 2  817464047 0
    1 0 1 0 0 63  10.56582 0  272974447 0
    2 0 1 0 0 27  9.235292 0 1428266571 0
    3 0 1 0 0 30  10.66773 0  272499811 0
    2 0 1 0 0 36  7.005369 0  137291331 0
    3 0 0 1 0 32   7.11205 1 1020246847 1
    2 0 . . . 46 11.250183 .  207301405 .
    2 0 . . . 40 12.368016 .  632680849 .
    2 0 0 1 0 41 4.0577807 1 1633863207 1
    1 0 0 1 0 53  8.339781 1 1031832050 1
    1 0 0 0 1 48 14.351636 2 1496270647 0
    2 0 1 0 0 31  8.128099 0  749051967 0
    1 0 0 1 0 38  8.393826 1  204595691 1
    2 0 1 0 0 22  7.415961 0 1293053331 0
    1 0 0 1 0 34 1.7935984 1  953455211 1
    3 0 0 0 1 30  9.163323 2 1514693250 0
    3 0 0 0 1 59  27.91911 2  899735290 0
    2 0 1 0 0 45  8.036906 0 1564185647 0
    2 0 1 0 0 52   8.39572 0   68347487 0
    2 0 1 0 0 43  9.642538 0 1632221687 0
    3 0 0 1 0 40  8.341923 1  136648051 1
    2 0 1 0 0 61   7.91378 0  884587527 0
    2 0 1 0 0 30 9.3492775 0 1428757535 0
    3 0 0 1 0 34  30.20827 1 1362220215 0
    2 0 0 1 0 29  8.465712 1 1088372651 1
    2 0 1 0 0 62  9.089383 0  680311447 0
    2 0 1 0 0 55  8.339748 0  680127847 0
    3 0 0 1 0 29 11.547344 1 1576940490 1
    2 0 1 0 0 57  9.034563 0  952405971 0
    2 0 . . . 46  9.006928 .  292491805 .
    2 0 0 0 1 32  8.006159 2  147111968 0
    2 0 1 0 0 24  6.996411 0  952102011 0
    2 0 1 0 0 47   5.24937 0  544368571 0
    3 0 1 0 0 39  6.942615 0 1428167967 0
    1 0 1 0 0 51  6.871824 0 1020477371 0
    3 0 1 0 0 23  8.610994 0 1360497091 0
    1 0 1 0 0 36  7.233235 0 1496003407 0
    2 0 1 0 0 37  7.192355 0  408194491 0
    2 0 1 0 0 57   6.09606 0 1564643291 0
    3 0 0 1 0 32 10.598147 1   68167971 1
    2 0 1 0 0 29  12.77013 0 1565245087 0
    2 0 1 0 0 44  15.60452 0  784618202 0
    3 0 1 0 0 25   7.14327 0  646837162 0
    2 0 0 1 0 22  8.506524 1 1173088450 1
    3 0 1 0 0 61  7.037473 0  408091127 0
    2 0 1 0 0 44  6.351039 0 1157193415 0
    3 0 1 0 0 37  21.36172 0  478699607 0
    2 0 1 0 0 45  8.764434 0 1158006242 0
    2 0 0 1 0 33  10.50508 1  680461727 1
    2 0 1 0 0 59  9.602529 0  823643288 0
    3 0 0 1 0 35  12.90046 1 1020246847 1
    2 0 0 0 1 61 13.684764 2 1496004767 0
    2 0 1 0 0 29  9.751111 0  952102011 0
    3 0 1 0 0 22  9.777349 0  476598411 0
    2 0 1 0 0 43  7.794011 0  749241011 0
    2 0 1 0 0 42  9.871921 0  817083247 0
    3 0 0 1 0 43  6.004619 1  750244011 1
    2 0 1 0 0 56  7.720224 0  680127847 0
    2 0 1 0 0 30  6.604361 0  136622211 0
    2 0 1 0 0 54  7.979677 0 1496018371 0
    2 0 1 0 0 45  8.185001 0  749227407 0
    2 0 1 0 0 48  7.265469 0 1360907131 0
    2 0 1 0 0 53 14.835987 0  680054407 0
    2 0 1 0 0 59 13.755212 0  817113847 0
    3 0 0 1 0 51 18.087383 1  816615407 0
    2 0 0 0 1 37  6.970546 2  749090731 0
    2 0 1 0 0 34  8.418858 0  612352251 0
    2 0 0 1 0 41  9.169399 1 1032790930 1
    2 1 1 0 0 45  4.122447 0  852203282 0
    2 0 0 0 1 59  8.277752 2 1496004767 0
    1 0 0 0 1 54  9.239238 2 1584406890 0
    1 0 1 0 0 52  8.610292 0 1564955411 0
    2 0 1 0 0 61  11.25866 0 1360426367 0
    3 0 1 0 0 26  13.99678 0  544456295 0
    2 0 1 0 0 43 11.913944 0  408031967 0
    2 0 1 0 0 56  7.394442 0 1224341367 0
    2 0 1 0 0 47  7.653486 0 1360907131 0
    2 0 1 0 0 56  9.746716 0 1224460367 0
    2 0 1 0 0 51 10.508083 0  958466926 0
    2 0 0 1 0 27  7.011311 1  544935695 0
    1 0 1 0 0 26  8.072807 0   68360407 0
    3 0 1 0 0 51   6.07246 0 1021605642 0
    3 0 0 1 0 41  9.902018 1  748245487 1
    2 0 1 0 0 51  8.268891 0 1632137367 0
    2 0 0 0 1 52  8.757375 2  477385167 0
    3 0 1 0 0 42 11.375958 0 1089158051 0
    3 0 0 0 1 23  7.505774 2 1088973771 0
    2 0 1 0 0 60 11.175456 0  544274727 0
    3 0 1 0 0 41  6.181662 0 1089188651 0
    1 0 1 0 0 40  14.12077 0  204696331 0
    3 0 1 0 0 36  9.988629 0  204004091 0
    3 0 0 1 0 33 12.046314 1   68167971 1
    2 0 0 0 1 42  9.890658 2 1632871767 0
    2 0 1 0 0 35  8.628632 0  612352251 0
    2 0 0 0 1 37 23.810846 2 1297297322 0
    3 0 0 1 0 21  7.239761 1  476444731 0
    2 0 1 0 0 29  11.12699 0  139070205 0
    2 0 1 0 0 55  16.05072 0  477004371 0
    2 0 1 0 0 28  8.463794 0  205986372 0
    2 0 1 0 0 45   7.23137 0  544361767 0
    3 0 1 0 0 24  7.143281 0 1428646762 0
    2 0 1 0 0 48  8.079432 0 1633136967 0
    2 0 0 1 0 59    7.3903 1 1496277447 1
    2 0 1 0 0 60  6.831589 0  884587527 0
    3 0 0 1 0 34  7.950408 1  341901971 1
    2 0 0 0 1 42  12.70208 2 1361389927 0
    2 0 1 0 0 43  5.750383 0  544368571 0
    3 0 1 0 0 44 15.043623 0 1428316211 0
    3 0 0 1 0 48  8.474241 1 1564465127 1
    2 0 1 0 0 22   9.33081 0 1428757535 0
    2 0 0 1 0 46  16.26753 1 1224301251 0
    2 0 0 0 1 41  8.792394 2 1361389927 0
    2 0 0 0 1 39  5.151426 2  817464047 0
    2 0 1 0 0 45  6.640464 0 1564760247 0
    2 0 0 1 0 58  7.815461 1 1496277447 1
    3 0 0 1 0 45  9.105049 1 1361073731 1
    2 0 1 0 0 27  12.19848 0  816746651 0
    2 0 1 0 0 46   8.82342 0 1564185647 0
    1 0 0 1 0 40  5.597103 1  681434127 1
    2 0 1 0 0 52  9.687369 0 1428390331 0
    2 0 1 0 0 44  8.970504 0  749227407 0
    3 0 1 0 0 23  6.881316 0  748024487 0
    1 0 1 0 0 58  8.272308 0 1564955411 0
    3 0 0 0 1 38 10.492478 2   69142407 0
    3 0 1 0 0 39   20.4976 0  478699607 0
    2 0 1 0 0 55  6.974183 0 1224341367 0
    2 0 1 0 0 51  11.76884 0 1157182531 0
    2 0 1 0 0 33   9.48629 0 1564339327 0
    2 0 1 0 0 45  9.095868 0  340648727 0
    3 0 0 1 0 39  8.955435 1 1564465127 1
    1 0 0 1 0 36  7.599288 1  953455211 1
    3 0 1 0 0 18 1.1194078 0   68469899 0
    3 0 1 0 0 23  7.808997 0  476598411 0
    2 0 1 0 0 42   9.52432 0  340648727 0
    1 0 1 0 0 19  6.252369 0  884767059 0
    2 0 1 0 0 45  9.282334 0 1632221687 0
    1 0 1 0 0 52  7.810379 0 1633251211 0
    2 0 0 0 1 24 10.007698 2 1225980855 0
    end
    label values match2 match2
    label def match2 1 "Under-Educated", modify
    label def match2 2 "Matched", modify
    label def match2 3 "Over-Educated", modify
    label values foreign2 foreign2
    label def foreign2 0 "Native", modify
    label def foreign2 1 "Immigrant", modify
    label values age a_dvage
    label values nat nat
    label def nat 0 "Native", modify
    label def nat 1 "Immigrant", modify
    label def nat 2 "2nd Gen.", modify
    label values fd fd
    label def fd 0 "UK Qualification", modify
    label def fd 1 "Non-UK Qualification", modify
    Code:
    dstat prop match2 if female==0 & (foreign1==1 | foreign2==1 | foreign3==1) & age>=16 & age<=64 & rhw>0 & rhw<., over(nat) graph(merge) vce(cluster pidp) 
    graph export $graphs_tables/overed_fig2.pdf, replace 
    graph save $graphs_tables/overed_fig2 , replace 
     
    dstat prop match2 if female==0 & (foreign2==1) & age>=16 & age<=64 & rhw>0 & rhw<., over(fd)   vce(cluster pidp) 
    graph export $graphs_tables/overed_fig4.pdf, replace 
    graph save $graphs_tables/overed_fig4, replace

  • #2
    You omitted the graph option from the second dstat command, so it doesn't draw the graph. You can either include an option like ,graph(merge) as in the first command, or add a -dstat graph- line before exporting.

    Comment


    • #3
      Thanks so much Ali, makes sense, I missed that.
      Happy New Year!

      Comment

      Working...
      X