Hello,

I am trying to automate the generation of graphs that highlight the coordinates where two lines intersect.

I have written the following piece of code:
Code:
sum x if xcosteffective ==1


twoway line  x wtp_threshold if wtp_threshold>0 & 6000>=wtp_threshold, xlabel(0(500)6000) xmtick(0(250)3500) ylabel(0(.5)1) ymtick(0(.25)1) ///
xline(497, lcol(gs10) lp(dash)) xscale(r(0 3500)) ///
  yline(`r(mean)' ,  lcol(gs10) lp(dash))    ytitle("Prob(cost-effective)") xtitle("Willingness to pay threshold  (US$ 2018)")  xscale(titlegap(*+20)) ///
  title("Females only")  text(`r(mean)'  4000 "(Threshold: US$ 4000," "Prob. C-Eff: `r(mean)')", color(magenta) size(small) placement(ne)) scheme(s1color) lcolor(magenta) ///
    graphregion(color(white))  plotregion(lcolor(white) lwidth(medium))

The challenge I have is that `r(mean)' returns a huge amount of decimal points (about 16). I tried a few ways of generating a new variable, including with
Code:
gen mean_cmb_prova=round(`r(mean)',.01)
sum mean_cmb_prova
but because Stata is so precise, even in this case r(mean) has about 16 decimal points, with a bunch of zeros between the first two and last five or six decimal points x-)
Is there any way to get r(mean) to keep the format I want? As you may infer from the second bit of code I want two decimal points only. Ideally a percentage format, in fact, but would not dare ask for too much...

Any suggestions would be much appreciated.

Thanks,
Giulia

P.S.: I also tried generating an entire new y constant=r(mean), but this squashes the graph, which shold be all about the x variable above