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

st: RE: svytab


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: svytab
Date   Tue, 8 Jul 2003 17:34:43 +0100

BDupont
> 
> Is there a way to combine a "by" statement or its 
> equivalent with the svytab
> command?  For instance, I have a file with multiple years 
> and want to
> breakdown the svytab results by year.  Using the simple 
> "tabulate" command
> allows me to do this using by year: tabulate <varlist>. The 
> svytab command
> does not but I'm wondering if there is another way to do this?

Try -levels-. 

levels year, local(Y) 
foreach y of local Y { 
	svytab onevar othervar if year == `y'
} 

In addition, see the FAQ 

Is there a way to tell Stata to try all values 
of a particular variable in a foreach statement 
without specifying them?
http://www.stata.com/support/faqs/data/foreach.html

Nick 
n.j.cox@durham.ac.uk 

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