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

Re: st: -Table- output presented horizontally and exported


From   jean ries <jean.ries@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -Table- output presented horizontally and exported
Date   Thu, 03 Nov 2005 16:51:15 +0100

To obtain the total number of non-missing observations, you have to add two lines at the end of the loop. So here is the amended code:

file open dum using DummyTable.txt, write text replace
file write dum _tab "yes" _tab "no" _tab "N" _n
foreach v of varlist dummy* {
file write dum "`v'" _tab
qui count if `v' == 0
file write dum (r(N)) _tab
qui count if `v' == 1
file write dum (r(N)) _tab
qui count if !missing(`v') // count the number of non-missings ...
file write dum (r(N)) _n // ... which is returned in r(N)
}
file close dum



*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index