Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Jean-Marie Meier" <jean-marie.meier@web.de> |

To |
statalist@hsphsun2.harvard.edu |

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/

**Follow-Ups**:**Re: st: Produce a list of two-sided p-values of all t-tests in a loop***From:*Tim Wade <wadetj@gmail.com>

- Prev by Date:
**st: How to test whether the median of a variable is different from 0** - Next by Date:
**st: Fixing nlsur restrictive identification requirements** - Previous by thread:
**st: How to test whether the median of a variable is different from 0** - Next by thread:
**Re: st: Produce a list of two-sided p-values of all t-tests in a loop** - Index(es):