I have the code below. I want to export the result from the code below to excel and also want to add standard deviations for the two groups SCTP and NonSCTP.
Code:
local vars "HAZ WAZ WHZ Female melevel region twins children_U5 water_source helevel year district AdjHAZ newcage newcage_6 newcage_11 newreligion newwealthsco newhhsex newwage newhhweight newchild_weight agediff"
matrix means = J(23, 3, -99)
matrix colnames means = NonSCTP SCTP t-value
matrix rownames means = `vars'
local irow = 0
qui {
foreach var of varlist `vars' {
local ++irow
sum `var' if SCTP == 0
matrix means[`irow',1] = r(mean)
sum `var' if SCTP == 1
matrix means[`irow',2] = r(mean)
ttest `var', by(SCTP)
matrix means[`irow',3] = r(t)
}
}
matrix list means, format(%15.4f)
0 Response to Desscriptive Statistics and Matrices
Post a Comment