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

st: RE: tabulation of variables


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: tabulation of variables
Date   Mon, 23 Sep 2002 11:12:22 -0400

Assuming you want to do this:

	tabulate a if d==.
	tabulate b if d==.
	tabulate c if d==.

for each of many variables d, the following code wil do it for you:

	foreach v1 of varlist <list of 'd' variables> {
		foreach v2 of varlist a b c {
			tab `v2' if `v1'==.
		}
	}

Nick Winter

> -----Original Message-----
> From: Banya, Winston [mailto:w.banya@ic.ac.uk] 
> Sent: Monday, September 23, 2002 11:06 AM
> To: 'statalist@hsphsun2.harvard.edu'
> Subject: st: tabulation of variables
> 
> 
> Dear All,
> 
> I am working on a dataset with several variables ( more than 
> 50) and I want
> list missing values in terms of 3 variables. For example if 
> variable d has
> missing values, then I will want to list all the a, b or c 
> for which d is
> missing. I want to issue just one command to do that for me 
> rather doing it
> for one variable at a time. Can someone please show me how to do it?
> 
> 
> Winston Banya
> Care of The Elderly Section
> Imperial College School of Medicine
> Hamersmith Hospital Campus
> Du Cane Road
> London W12 0NN
> 
> Tel: (+44) 0208 383 4284
> Fax: (+44) 0208 383 3378
> Email: w.banya@ic.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/
> 
*
*   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