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: tricky putexcel syntax


From   Nick Bornschein <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: tricky putexcel syntax
Date   Tue, 18 Mar 2014 13:35:30 +0100

Hello Stata list,

I'm trying a little tricky putexcel command with the tab syntax command. Hope someone can help me (I'm sure).
First the code:

------------

local funct (here are 20 variables included)

putexcel A1=("Company Type / Industry") using chi2.xlsx, sheet("var119") replace
putexcel A1=("Company Size") using chi2.xlsx, sheet("var5_r") modify
putexcel A1=("Company Spread") using chi2.xlsx, sheet("var90") modify
putexcel A1=("Company Turnover") using chi2.xlsx, sheet("var4") modify
putexcel A1=("Accounting Standard") using chi2.xlsx, sheet("var796") modify
putexcel A1=("Currency Number") using chi2.xlsx, sheet("num_curr_r") modify

foreach x of varlist `funct' {
        tabulate var119 `x', chi2 exact V gamma
        putexcel ...
}

-----------

Aus you can see I create an Excel file with some sheets. After that I calculate a Chi2 statistic with my first variable "var119" in a loop and now I want to put the results to the same sheet. In this sheet A1 is the title. Now I want all variable names I use in the loop, defined via "local funct..." starting in A3 to A4, A5 and so on (20 new lines with variable labels). Column B (first should be B3) should contain the chi2 value, which I know is available via return list command, but I also dont know how to put the values step by step zo the next line because of the loop.

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