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: putexcel with a loop


From   Jeph Herrin <info@flyingbuttress.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: putexcel with a loop
Date   Tue, 18 Feb 2014 10:46:48 -0500

Maybe:

 local c=66
 foreach x of varlist koerper1-eltern4 {
    su `x'
    putexcel `=char(`c')'2=rscalars using deskriptiv, //
	sheet("deskriptiv") modify
    local c=`c'+1
 }

hth,
Jeph


On 2/18/2014 8:29 AM, Nick Bornschein wrote:
Hello,

I created an Excel file called "deskriptiv" with labels etc. and now I
want to put the results from summarize commands into loop to put it in
excel. Therefor I created:

foreach x of varlist koerper1-eltern4 {
         su `x'
         putexcel B2=rscalars using deskriptiv, sheet("deskriptiv") modify
}

The thing is: I need to modify B2 so that the "su koerper1" results will
be put in B2 (and below) but the next "su koerper2" should be put in C2
and below. How do I get that? I tried something with [_n] but it does
not work.

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/

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