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)
Related Posts with Desscriptive Statistics and Matrices
Calculate pairwise differencesHi friends, I have data: Code: * Example generated by -dataex-. To install: ssc install dataex cl…
Identifying peaks and throughsDear all, By following the method of Bry and Boschan (1971), full reference placed below, I want to…
using * in a for-loopHello, I can't figure out what does * mean in front of a for-loop. Here you can see an example: fo…
Out-of-sample logit: applying estimated coefficients on a new series (w/o observing 0s/1s)Hello STATA community, This is both a methodological question and a programming question, for which…
tabulate two variables to show the value of a third variable; save dataset as matrix; multiple plots using plotmatrixHi all, I have data: Code: * Example generated by -dataex-. To install: ssc install dataex clear…
Subscribe to:
Post Comments (Atom)
0 Response to Desscriptive Statistics and Matrices
Post a Comment