Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: t test and name of variables involved in the test


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: t test and name of variables involved in the test
Date   Sun, 2 Apr 2006 18:31:52 +0100

foreach v of varlist competence form_gest exp_fi {
	foreach g of varlist interne independant comite_audit {
		di _n "`v' by `g':" 
		ttest `v', by(`g'), if directoire==0 & president_ca==0
	}
}

See also Stata Journal 2(2), 202-222 (2002). 

Nick 
[email protected] 

Herve STOLOWY
 
> I searched in the help and the 
> Stata manual (8.2) but I don't know how to use -display- to 
> get the variable names.

Justin

> You can -display- the two variable names before the ttest.

Herve STOLOWY 

> > I use the following loop to perform 9 t tests:
> >
> > foreach varname of varlist competence form_gest exp_fi {
> > foreach groupvar of varlist interne independant comite_audit {
> > ttest `varname', by(`groupvar'),  if directoire==0 & president_ca==0
> > }
> > }
> >
> > I have no problem with the loop and I get the results I was 
> looking for.
> >
> > However, in the output, the variable names are not 
> mentioned. Given that
> > I have 9 outputs, it's rather combersume to determine which 
> test is based
> > on which variables.
> >
> > When I do a single t test for one varname and one groupvar, the same
> > problem exists (no variable names in the ouput) but the command line
> > tells me which variables are involved.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index