Announcement

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

  • Problem with graph export using globals

    Hi,

    I am using globals to store my file paths - all the globals are stored in a master dofile that I run first. The globals are working fine when it comes to opening/saving documents - but I am having trouble naming my graphs correctly using graph export.

    For example, where the relevant globals are:

    Code:
    global projectfolder "/home/bs3313/Documents/DS138"
    global DS138_dtFin "$projectfolder/Dataset/Final"
    global DS138_out  "$projectfolder/Output"
    global lmic "-LMIC"
    Code:
    use "$DS138_dtFin/Launch$lmic-panel.dta", clear
    Works fine & opens the relevant file (/home/bs3313/Documents/DS138/Dataset/Final/Launch-LMIC-panel.dta)

    However graph export does not name the file correctly:

    Code:
    sts, fail by(eml)
    graph export "$DS138_out/KM$lmic_launches.png", as(png) width(5000) replace
    saves the file as: /home/bs3313/Documents/DS138/Output/KM.png

    Could anyone advise me as to where I am going wrong?

    Thanks, Bryony

  • #2
    Stata is looking for a global variable named $lmic_launches and not finding it. Change your code to
    Code:
    graph export "$DS138_out/KM${lmic}_launches.png", as(png) width(5000) replace

    Comment


    • #3
      brilliant - thanks so much for that!

      Comment

      Working...
      X