Bookmark and Share

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]

RE: st: t-test query


From   "Mirnezami, Oliver" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: t-test query
Date   Fri, 19 Apr 2013 13:47:31 +0000

Perfect! Thanks Nick. Much appreciated.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: 19 April 2013 14:40
To: [email protected]
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
[email protected]


On 19 April 2013 14:34, Mirnezami, Oliver <[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index