Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: controlling display formats in macros


From   "Campbell, Richard T." <dcamp@uic.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: controlling display formats in macros
Date   Sat, 27 Feb 2010 18:11:17 -0600

For teaching purposes, I am using lfit to run some
regression models with graphic displays. I want to
capture the slope value and display it in the title
for the graph. I capture the value of the slope in
a variable and set a local macro to the value of that
variable. I then insert the value of the macro in
the title line as in title (slope is `slope'). This
works nicely except that the slope value is printed to
about 18 decimal places.

Here is the code.

reg ln_wage = ttl_exp
matrix slope = e(b)
gen b11 = slope[1,1]
format b11 %4.3f
local b1 = b11
twoway ///
(lfit ln_wage ttl_exp, lcolor(black) lwidth(medthick)), ///
    	 title (Wages regressed on labor force experience) ///
	 subtitle (slope = `b1')

I can't attach the graph, but as I said, the value of b1
in the subtitle (last line above) displays 18 digits. Is
there some way to control this display format?






*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index