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]

st: loop: integrate generate syntax in existing loop


From   Nick Bornschein <[email protected]>
To   [email protected]
Subject   st: loop: integrate generate syntax in existing loop
Date   Thu, 04 Jul 2013 12:27:14 +0200

Hi,

I want to include multiple generate commands in a ttest loop (which is working perfect without the generate), but I don't get it...

foreach x of varlist a-d {
ttest `x', by(group)    {
gen lower_`x' = r(mu_1) - r(sd_1)*1.96    {
gen upper_`x' = r(mu_1) + r(sd_1)*1.96    {
gen lower2_`x' = r(mu_2) - r(sd_2)*1.96    {
gen upper2_`x' = r(mu_2) + r(sd_2)*1.96    {
    }
    }
    }
    }
    }
}

How to integrate the generate?

Best
-Nick
*
*   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