Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Need help understanding stata graphics from http://www.survey-design.com.au/Stata%20Graphs.html.


From   Michael Stewart <[email protected]>
To   statalist <[email protected]>
Subject   st: Need help understanding stata graphics from http://www.survey-design.com.au/Stata%20Graphs.html.
Date   Mon, 8 Jul 2013 08:38:57 -0400

Hello ,


I am trying to learn stata graphics from the webpage
http://www.survey-design.com.au/Stata%20Graphs.html.
I couldn't understand  few graphs and was hoping if
senior/experienced programmers would help me understand them


QUESTION:


*****************example start ******************************

histogram - add x bar labels for the centre of each bar

sysuse auto, clear
twoway__histogram_gen mpg  , bin(6) generate(h x , replace )
count if !missing(x)
forvalues i=1/`=r(N)' {
  local label `label'  `=string(x[`i'],"%8.2f")'

}

histogram mpg , bin(6) xlabel(`label')

*****************example end ******************************

I cant understand stata commands after "count if !missing(x)"

1)What is the utility of the forach loop
2)what does the notation   i=1/`=r(N)' mean ; typically I  see macros
like `r(N)'
3)How does local label `label'  `=string(x[`i'],"%8.2f")' work?

Thanks a lot for your time and consideration.
--
Thank you ,
Yours Sincerely,
Mike.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index