LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2000)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 19 Dec 2000 11:26:43 -0500
Reply-To:     Deinya Phenix <deinya.phenix@NYU.EDU>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Deinya Phenix <deinya.phenix@NYU.EDU>
Subject:      Re: Automate a complex search
Comments: To: Carol Albright <syzygy@TC.UMN.EDU>
In-Reply-To:  <>
Content-Type: text/plain; charset="iso-8859-1"

Amy, Carol's solution is first rate. I would only add that you can reduce the lines of code by half if you use: COMPUTE FLAG1=ANY("1234", dx1, dx2_1 to dx2_15). repeated for each diagnostic code. Also, beware of case sensitivity.

If you're doing 35 (or more) diagnostic codes, you might want to use a simple macro just so you can put all your codes in one command line. Even if you add codes later, this'll give you 6 lines (plus your documentation) instead of 37 or 72:

DEFINE diagflag (!POS (!CMDEND)). !DO !diag !IN !1. COMPUTE FLAG1=ANY(!QUOTE(!diag), dx1, dx2_1 to dx2_15). !DOEND. !ENDDEFINE.

DIAGFLAG code code code ...list your codes here... SELECT IF FLAG EQ 1. SAVE OUTFILE=newname.

Good luck, -D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Deinya Phenix Data Analyst NYU Institute for Education and Social Policy New York, NY 10003 (212) 998-5073 voice (212) 995-4564 fax ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Carol Albright Sent: Monday, December 18, 2000 7:07 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: Automate a complex search

Hi, Amy!

Here's the semi-brute force method, so I'm dying to know if there's a more resource efficient method. First compute a flag that says the record meets criteria. The ANY keyword permits more compact code. The DO IF (hopefully!) speeds up the process, because once you've decided a record meets your criteria, SPSS won't bother checking for the remaining diagnoses. This variant looks at one code at a time across all 16 variables. (Another alternative would be look at one variable at a time for any of the 35 codes, but I'm not sure what the maximum number of items ANY can handle).

DO IF ANY("1234", dx1, dx2_1 to dx2_15). compute flag = 1. ELSE IF ANY("234C", dx1, dx2_1 to dx2_15). compute flag = 1. ELSE IF ANY("CODE#3", dx1, dx2_1 to dx2_15). ... (repeat this pattern for each of the 35 codes) ... END IF. EXECUTE.

* Now select the cases -- remember SELECT drops everything not meeting your criteria. SELECT IF FLAG = 1.

HTH, Carol

At 05:21 PM 12/18/00 -0600, Amy Shadoin wrote: <snip> I have about 7 million hospital discharge records with string variables >that indicate primary (dx1) and secondary (dx2_1 to dx2_15) ICD-9 >diagnoses. There are thousands of value labels within each diagnostic >variable (dx1, dx2_1 to dx2_15). > > I am only interested in selecting and saving records for those people who >have a combination of diagnoses that include any one of about 35 ICD-9 >codes recorded within either their primary diagnosis variable or any of >their secondary diagnosis variables. <snip>

------------------------------------------------------------------------- Carol L. Albright, MS | E-Mail : Albright Consulting | Phone : 651/699-7218 2031 Goodrich Avenue | St. Paul, MN 55105 USA | Research data services -------------------------------------------------------------------------

Back to: Top of message | Previous page | Main SPSSX-L page