next up previous
Next: More data modification Up: No Title Previous: Summarising data

Graphs in Stata

Stata has powerful and complicated commands that allow you detailed control over the appearance of your graphs. They are explained in the manual. This is a simple example of a graph to demonstrate printing and saving.

dotplot alcohol, by(age) center

This produces a dotplot, a sort of table with a dot for each observation. As there are so many observations (975) they blend togther into lines. You can still see the relationship between age and alcohol consumption. A more useful graph would give this relationship only for controls (to give a better idea of the population relationship).

dotplot alcohol if case==0, by(age) center

This if syntax is allowed for most Stata commands. You don't need to know it, but it might be useful.

To print this graph or to save it in a PostScript file for printing on some other printer, use File| Print Graph. Select the HP Laserjet printer unless you want to print on the dot-matrix printers (slow and not very attractive). To save to a PostScript file click on the box labelled Print to File. Click Ok. If you selected Print to File you will be asked for a file name. Make sure the file you specify is in your temporary folder. It is a good idea to use the extension .PS rather than the default .PRN.

To view a PostScript file, find it in Windows Explorer and double-click on it. A program called GSView will be loaded to display the graph.

You can also save graphs in a form that can be recognised by most Windows word-processors. Use File| Save Graph and change the Save as type to Windows Metafile (*.wmf). Make sure you select your temporary folder and then type in a file name ending with .WMF. In Microsoft Word you can insert this picture in a document using Insert| Picture.



next up previous
Next: More data modification Up: No Title Previous: Summarising data



Thomas Lumley
Wed Jan 22 09:16:46 PST 1997