I wrote code that uses local macros and matrices to extract p-values from many ttests, and outputs them to excel. However, at some point the p-values get rounded to the nearest hundredth (i.e., a p-value of 0.0008 will show up in my document as 0. Using the below code, how would I adjust so that this rounding does not occur?
Code:
local ttest "var1 var2 var3" local n: word count `ttest' local i=1 foreach var of local ttest { ttest `var', by(CST4v1) // local pvalue: display %05.4f chi2tail(r(df), r(chi2)) local pvalue: display (r(p)) mat r`i'= `pvalue' local ++i } forvalues j=2/`n'{ local all "`all' \r`j'" } mat R= r1`all' mat rownames R = `ttest' mat colnames R= "P-value" putexcel set ttest_doc putexcel A1=matrix(R), names
Clare
0 Response to Getting exact numbers when extracting p-values from ttests
Post a Comment