Microsoft Word Saving Graphs 2018.docx

Transcript

1 Revised 2018 July Saving Graphs how to save a graph generated in Stata. As noted in the “Creating a Log s notes show This set of ” handout, log files record all your Stata commands and output in a given session but do not File up on your computer save graphs. the “ Getting This handout assumes that you have set Stata (see ted with Stata ” handout), and that you have read in the set of data that you want to analyze Star the “ Reading in Stata Format (.dta) Data F iles ” handout). (see “ Stata command In Stata, most tasks can be performed either by issuing commands within the ” menus. These notes illustrate both approaches, using the data file or by using the window, ” “ this data file is posted here: https://canvas.harvard.edu/courses/53958 ). GSS2016.DTA ( You can save graphs generated in Stata as many different formats (see: https://www.stata.com/manuals13/g 2graphexport.pdf ) but it is recommend ed to save graphs as - Portable Network Graphic (PN .png extensio ns) . This format should work on both PCs G) files ( and Macs . After you generate a graph in Stata, for example , a scatterplot of number of words correct on a vocabulary test and years of schooling scatter wordsum educ ), you issue the following ( command graph export ” file path & file name ” Stata C ommand box. in the On a PC: If one wanted to save a scatterplot as a PNG file on hard disk C:, in the folder “GRAPHICS”, one would type \ GRAPHICS \ scatter_vocabeduc.png " graph export "C: On a Mac: If one wanted to save a scatterplot as a PNG file in user1’s folder on the hard dr ive, in the folder “graphics”, one would type " /Users/user1/graphics/scatter_vocabeduc.png graph export " Note: PC file paths use a backslash whereas Mac file paths use a forward slash. If you would like to replace an existing graph with a newer version , add “replace” after the file name (Note: PC file path) : graph export "C: GRAPHICS \ scatter_vocabeduc.png " , replace \

2 Alternatively, you can save the graph using the menus in the “Stata Graph” window. To save the e” option. To immediately print the graph you generated, click the “Print” graph, click the “Sav option. To copy the graph to the clipboard, click the “Copy” option. See below for an image of the Stata Graph window with the different menu options. 2

Related documents