Announcement

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

  • How to save a "line" graph in an Excel file?

    Hi,

    I would like to save the following graph in an Excel file:


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(cum_inv_EW_DCA sum_cap_inv date)
     18.56148845609046   20 19984
     35.86825214202078   40 19985
     57.86469950450826   60 19986
     75.94466921025628   80 19987
     96.74600892469607  100 19988
    126.51151110033022  120 19989
     142.2801395273599  140 19990
    157.82017936672926  160 19991
    174.73145298996064  180 19992
    192.36968601085326  200 19993
    200.49512601298062  220 19994
    219.49314966466247  240 19995
     246.8137941169403  260 19996
     264.5183048762408  280 19997
    278.18216145796765  300 19998
    285.81196600948465  320 19999
      279.743538614689  340 20000
     292.1275091837158  360 20001
     321.4462450802296  380 20002
     347.7645939744611  400 20003
     386.0911691998247  420 20004
     419.9972649584401  440 20005
    435.82182079372114  460 20006
    456.75095664028004  480 20007
    498.13440735415617  500 20008
       534.37446975895  520 20009
     569.2216220503781  540 20010
     580.2599251508215  560 20011
     581.6837273804449  580 20012
     603.5742255913641  600 20013
     636.0600582349705  620 20014
     652.8823530049207  640 20015
     661.3073981561233  660 20016
     687.7673212461044  680 20017
     701.6927355875159  700 20018
     675.0921191478451  720 20019
     694.9525041801775  740 20020
     692.8581884119667  760 20021
     728.1162576302805  780 20022
     744.4991110708975  800 20023
     774.5245338214474  820 20024
     745.5868468919117  840 20025
     787.7474617723992  860 20026
     791.4103353922958  880 20027
     781.2582982617587  900 20028
      801.610053586887  920 20029
     825.8001105938737  940 20030
     853.3865728429602  960 20031
     897.1548584911378  980 20032
     943.6413764511475 1000 20033
     944.6742308346187 1020 20034
     973.3316842291523 1040 20035
    1044.4404482221935 1060 20036
    1075.1650318528807 1080 20037
    1097.4662381887572 1100 20038
    1287.2492524784254 1120 20039
    1298.5272207312182 1140 20040
    1246.7084301705056 1160 20041
    1197.6603504168024 1180 20042
    1255.6955217140967 1200 20043
     1274.136598075606 1220 20044
    1253.3491132604106 1240 20045
    1291.5297135550595 1260 20046
     1233.245644085988 1280 20047
    1228.7578879536864 1300 20048
     1256.132741527754 1320 20049
    1329.1168547285406 1340 20050
    1383.3537713049275 1360 20051
    1397.5712951872254 1380 20052
     1391.217595538014 1400 20053
    1416.1979367737765 1420 20054
     1462.527045110625 1440 20055
    1478.7621406384214 1460 20056
    1508.9643453838837 1480 20057
     1533.809500198964 1500 20058
    1562.2905522483877 1520 20059
    1556.1275919104105 1540 20060
    1553.4067178232542 1560 20061
    1604.2700163285879 1580 20062
    1615.3524656906388 1600 20063
     1636.705119486538 1620 20064
    1598.4656860786533 1640 20065
     1575.131761021523 1660 20066
    1568.6201081333568 1680 20067
    1607.6131097569405 1700 20068
    1637.0674061905293 1720 20069
     1632.785517625126 1740 20070
    1673.0351182628385 1760 20071
    1662.7645746118824 1780 20072
    1593.6769488517552 1800 20073
    1577.7288180129458 1820 20074
    1555.8589608575533 1840 20075
    1608.4847770800525 1860 20076
    1690.5463870918036 1880 20077
    1663.3030531840939 1900 20078
    1741.2401585165815 1920 20079
    1775.4941495602898 1940 20080
    1730.8917668717704 1960 20081
    1731.7506959201658 1980 20082
     1800.710708449396 2000 20083
    end
    format %td date
    Code:
    line  cum_inv_EW_DCA sum_cap_inv date
    I have taken a look in the help file and through the GUI Graphics> Twoway Graph but I could not find it. Thanks

  • #2
    I doubt this is possible and I don't know why it would be desirable. Presumably there's a shell command that can write a png file/picture file to an excel file but again, why you'd want this is a mystery to me.

    Comment


    • #3
      Hi Francois
      Following on Jared's advice.
      1. You cannot use Stata to SAVE excel format graphs in Excel.
      2. You could store the data you created in Stata and Save it to excel to make the graph there. To update it, you just modify the data, not the graph
      3. You can use Stata to create the figures you want (and save them in say PNG format), and then save them in excel.

      For option 3, after making your graph tye
      graph export fig1.png , (other options)

      for all other options look into -putexcel-.

      HTH

      Comment


      • #4
        I interpreted your question as wanting to use Stata to produce a graph, exported a copy of that graph to an image file format, and then place them into an Excel file. This seems like a reasonable thing to do and is straightforward using -putexcel-.

        Code:
        line  cum_inv_EW_DCA sum_cap_inv date , name(mygraph, replace)
        graph export mygraph.png, as(png) name(mygraph) replace
        
        putexcel set myexcel.xlsx, sheet("My Graph") replace
        putexcel C3 = image(mygraph.png)
        putexcel describe
        Further information can be found at

        Code:
        help graph export
        help putexcel

        Comment

        Working...
        X