Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Kwallis in a loop


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: Kwallis in a loop
Date   Sun, 6 Nov 2005 13:42:17 -0500

Herve said

foreach var of varlist index2 prov_ass {
egen rank_`var' = rank(`var') if sodas3cl < .
bysort sodas3cl : egen ranksum_`var' = sum(rank_`var')
by sodas3cl : egen rankmean_`var' = mean(rank_`var')

tabstat rankmean_`var', by(sodas3cl) save
tabstatmat statdes3
mat2txt, matrix(statdes3) saving(statdes3) append

}

My problem is the following:

At the end of the loop, the first time, I should have -replace- and the subsequent times -append-. I don't know how can I make Stata understand this difference in a loop.


local action replace
foreach ... {

mat2txt. ... `action'
local action append
}

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index