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
Adding baseline variables to a linear mixed modelHello everyone, I am really new to Stata, so my apologies if it's a simple question or if I misunde…
Run Seemingly unrelated regression (SUREG) with one of the explanatory variable being latentHi All I have difficulty running an SUREG translog cost function where one of my independent variabl…
Strange Clustering Result from rdrobustI notice that when I use the package rdrobust, I can easily replicate the resulting point estimate b…
Strange Clustering Results from rdrobustI notice that when I use the package rdrobust, I can easily replicate the resulting point estimate b…
getting multiple variables information in one variable after importing txt fileAfter importing delimited using abcd.txt data this is the following output I'm getting on my data ed…
Subscribe to:
Post Comments (Atom)
0 Response to Desscriptive Statistics and Matrices
Post a Comment