Announcement

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

  • Looping graph export: Getting unique export file names

    Below, a loop draws scatterplots of income quintiles (*Lowest to *Fifth) against year for 3 jurisdictions (Florida, etc). The x (`x') helps define the variable names uniquely for each jurisdiction. I want the exported file names
    also to be defined uniquely for each jurisdiction. However, Stata does not seem to "see" the `x' in the emf export file name and instead returns this red "already exists" error:

    file C:\Users\me\Desktop\Analysis\output_dr afts.emf already exists

    Code:
    foreach x in  Florida NY NJ {
    twoway connected `x'Lowest `x'Second `x'Third `x'Fourth `x'Fifth  Year, name(`x', replace)
     graph export C:\Users\me\Desktop\Analysis\output_drafts\`x'.emf
    }
    Can this be remedied somewhat simply? This looping project has me going in circles and the next phase of my analysis will draw 30 graphs.
    Last edited by Andrew Kenny; 11 May 2018, 20:27.

  • #2
    Originally posted by Andrew Kenny View Post
    Can this be remedied somewhat simply?
    Yes. \ → /
    Code:
    graph export C:\Users\me\Desktop\Analysis\output_drafts/`x'.emf

    Comment


    • #3
      Awesome - that does it!

      Comment

      Working...
      X