Hi,
I was able to create a loop to export p-values from chi2 and fisher's exact tests into excel using the code below. Is there a way this can be modified for continuous variables and ranksum tests?
Thanks!
Priscilla
I was able to create a loop to export p-values from chi2 and fisher's exact tests into excel using the code below. Is there a way this can be modified for continuous variables and ranksum tests?
I tried using the code below, but it produces the following error message: "nothing found where expression expected"
putexcel set "C:\Users\priscilla\stataexport", sheet("p-values") modify
scalar k = 5
foreach v of varlist categorical1 categorical2 categorical3 {
tabulate exposurename `v' if cond1!=. & cond2!=., chi2 exact row col
putexcel D`=k' = `r(p)'
scalar k = k + 1
}
Is there any way I can fix this?
ranksum continuous1 if cond1!=.& cond2!=. & exposurename!=., by (exposurename)
putexcel D6 = `r(p)'
Thanks!
Priscilla
Comment