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: Problem with caption in a graph


From   Benjamin Villena <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Problem with caption in a graph
Date   Sat, 7 Sep 2013 14:32:27 -0700 (PDT)

Dear Statalist,
 I want to place the R-squared of a regression on a graph using a code like this

reg y x
local r2=round(e(r2),0.001)
line y x, caption("R2=`r2'" , size(small) position(2) ring(0))

The problem is that the caption text shows R2=0.87600000000000000000001 despite the fact I'm using round to keep only three decimal digits. 

I'd appreciate if you can give me some advice on how to deal with this issue.

Thanks


Benjamín 

*
*   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