Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Produce a list of two-sided p-values of all t-tests in a loop
From
"Jean-Marie Meier" <[email protected]>
To
[email protected]
Subject
st: Produce a list of two-sided p-values of all t-tests in a loop
Date
Mon, 9 May 2011 00:16:48 +0200 (CEST)
Dear Stata list users,
for my data set I want create several tables with descriptive statistics. For these tables I want to test whether the mean and median value of variables are different from 0.
I run the t-tests with the following loop. I now want that Stata produces a list of the two-sided p-values of all t-tests in the loop. the two sided p-value is saved as r(p) if the command ttest is used.
Thus it should be possible to add a command to the loop, that the two-sided p-value is saved each time with a different name (such that not only one p-value is saved, which is constantly overwritten).
However I do not know how to do that! It would be great if someone could help me.
local j=0
global global_name var1 var2 var3 ...
foreach x in $global_name {
local j=`j'+1
ttest `x' == 0
}
Kind regards,
Jean-Marie Meier
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/