Statalist The Stata Listserver


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

st: Re: Programming style for multiple AND and OR constructs


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: Programming style for multiple AND and OR constructs
Date   Wed, 31 May 2006 07:41:50 -0400

inlist() and inrange() may be what you are looking for

Michael Blasnik
[email protected]

----- Original Message ----- From: "David Winter" <[email protected]>
To: <[email protected]>
Sent: Wednesday, May 31, 2006 5:54 AM
Subject: st: Programming style for multiple AND and OR constructs



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