Putting data set results in a graph

Below is a worked example of putting data set results in a graph. The data set I used is automobile dataset:

The commands I used in a do-file are:

clear all

sysuse auto

quiet: summarize mpg

twoway ///

scatter mpg rep78, ///

text(40 3 "The mean mpg is:`=string(`=r(mean)',"%8.2f")'", placement(right)) ///

text(38 3 "The sd mpg is: `=string(`=r(sd)',"%8.2f")'" , placement(right))


You may find more useful information in the book Speaking Stata Graphics


© 2020 by Survey Design and Analysis Services. 

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube