Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Programming style for multiple AND and OR constructs


From   "David Winter" <d.l.winter@bham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Programming style for multiple AND and OR constructs
Date   Wed, 31 May 2006 10:54:58 +0100

I am writing a Stata program to aggregate classifications based on a
cancer TYPE and SITE. I am converting the code from SPSS so it is
syntactically rather inefficient, for example:

DO IF (TYPE = n OR TYPE = n2 OR TYPE = .... etc (further 5 iterations)).
COMPUTE group = 1
.
.
ELSE IF (TYPE = n AND TYPE = n2 AND TYPE = .....) etc.
COMPUTE group = 2

To make this a bit easier SPSS has a function: ANY(TYPE,n1,n2,n3).  Does
Stata has a similar function?  I see there are functions -anyof()- and
-allof() but they appear to have a different function.

Regards,

Dave


****************************************************
Mr David L. Winter, HNC
I.T. Manager (BCCSS Study)
Department of Public Health & Epidemiology
Room 105, Public Health Building
University of Birmingham
Edgbaston
Birmingham
B15 2TT
UK
tel.: +44 (0)121 414 6766
fax.: +44 (0)121 414 7923
****************************************************


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