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
Bar Graph with datesDear Statalist, I have a list of several countries with dates of COVID-19 lockdown. I would like to…
Merge 2 datasets by range of datesHi, I would like to merge 2 datasets by range of dates and with an identifier (gvkey). So far, I ha…
Is Durbin–Wu–Hausman test a valid test when using generated regressor without any declaration of IVs?Dear All, Recently I have an exactly the same question with an old faq on Stata about Durbin–Wu–Hau…
Time Series: how to obtain a date variable collapsing year and month (dm)?I have time series data of an index of employment in Brazilian industries. Part of the data is repro…
Alternative to inlist() - expression too longHi, Relatively basic question: I am looking for a concise (1 line) alternative to inlist that would…
Subscribe to:
Post Comments (Atom)
0 Response to Desscriptive Statistics and Matrices
Post a Comment