Jack Gibson Thanks for all of your help again. The code works perfectly. For continuous variables, I had to remove the (i.) from the logistic regression command for it to work.
I was think of how to add the the variance table. So I tried this and it didn't work:
forvalues curreg=2(-1)1 {
use `maindata', clear // load the data
tab `var' malperfusion, sdtest matcell(X)
local chi2val=r(sdtest)
local sdtestp=r(p)
.....
// add in the crosstab results
svmat X
gen sdtest=`sdtestval' in 1
gen sdtest=`sdtestp' in 1
}
I was think of how to add the the variance table. So I tried this and it didn't work:
forvalues curreg=2(-1)1 {
use `maindata', clear // load the data
tab `var' malperfusion, sdtest matcell(X)
local chi2val=r(sdtest)
local sdtestp=r(p)
.....
// add in the crosstab results
svmat X
gen sdtest=`sdtestval' in 1
gen sdtest=`sdtestp' in 1
}
Comment