I can't seem to find out how to do this... please help
I just need to include a note in a graph with a p-value from a previously performed statistical test. The issue arises when I try to format the number in a specific way, namely concerning a specific number of decimal places, and a zero before the decimal separator (e.g. .8899999 -> 0.890).
I tried checking the format options for variables but it doesn't work with a value in a macro.
Specific example:
I kind of solved the "zero before decimal separator" issue by including a "0" in the note text string before the macro call, but it still doesn't work because when `pvaluebon'==1 it becomes "01"...
Many thanks in advance,
I just need to include a note in a graph with a p-value from a previously performed statistical test. The issue arises when I try to format the number in a specific way, namely concerning a specific number of decimal places, and a zero before the decimal separator (e.g. .8899999 -> 0.890).
I tried checking the format options for variables but it doesn't work with a value in a macro.
Specific example:
Code:
foreach drug in crt mtx mmf iet prost aas ieca bcc pentox nitratos {
display ""
display "======== `drug' ======== "
display ""
ttest hey2_ct, by(`drug')
local pvalue=round(r(p),.001)
local pvaluebon=`pvalue'*8
if `pvaluebon'>1 local pvaluebon=1
local vlabel : variable label `drug'
graph box hey2, over(`drug') ///
yscale(log extend range(.4)) ylabel(.4 1 2 3) yline(1) ///
name(`drug', replace) title("`vlabel'") ytitle("Hey2 RQ", size(small)) ///
note("p=0`pvalue' / p=0`pvaluebon'", size(small)) nodraw
}
Many thanks in advance,

Comment