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]
Re: st: controlling display formats in macros
From
Eric Booth <[email protected]>
To
[email protected]
Subject
Re: st: controlling display formats in macros
Date
Sat, 27 Feb 2010 18:29:01 -0600
>
See -help extended_fcn-:
***
**using auto.dta:
webuse auto, clear
rename price ln_wage
rename mpg ttl_exp
**
reg ln_wage ttl_exp
matrix slope = e(b)
local b1:di %4.2f slope[1,1]
twoway ///
(lfit ln_wage ttl_exp, lcolor(black) lwidth(medthick)), ///
title (Wages regressed on labor force experience) ///
subtitle (slope = `b1')
***
~ Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
On Feb 27, 2010, at 6:11 PM, Campbell, Richard T. wrote:
> 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/
*
* 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/