Bookmark and Share

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]

RE: st: t-test query


From   "Mirnezami, Oliver" <O.Y.Mirnezami@warwick.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: t-test query
Date   Fri, 19 Apr 2013 13:47:31 +0000

Perfect! Thanks Nick. Much appreciated.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 19 April 2013 14:40
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: t-test query

Stata of course is just following your instructions here!

The outer loop over 4/4 serves no purpose here.

In essence you have

foreach j in health married hispanic college  {
     ttest `j' if (sample4 ==1), by(treatment) unequal }

and you want to add informative text. One example is

foreach j in health married hispanic college  {
     di "`j'"  _n
     ttest `j' if (sample4 ==1), by(treatment) unequal }

and you can add whatever decoration you want

foreach j in health married hispanic college  {
     di "{title:`j'}"  _n
     ttest `j' if (sample4 ==1), by(treatment) unequal }

See the help for -display- and for -smcl-.


Nick
njcoxstata@gmail.com


On 19 April 2013 14:34, Mirnezami, Oliver <O.Y.Mirnezami@warwick.ac.uk> wrote:
> Hello
>
> I am trying run a series of difference in means tests using the code below. How can you add some sort of label to show which variable the test refers to? Stata just does one test after another after another but doesn't label. I guess I can go through the order of the variables but would be nice if it was clearly labelled. I've had a look through the help guide but can't find a way to do this. I've included just a few variables here but I wish to run this for many and so it's difficult to identify which variables are in which test otherwise.
>
> local varlist health married hispanic college local yeareffects  y1994 
> y1996 y1998 y2000 local controls married hispanic college
>
> xtreg health `controls `yeareffects' , fe vce(cluster id) gen sample4 
> = e(sample) forval i = 4/4 { foreach j in `varlist' { ttest `j' if 
> (sample4 ==1), by(treatment) unequal } }
>
> Thank you
>
> Oliver
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index