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 (November 2011, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 29 Nov 2011 15:24:24 -0500
Reply-To:     "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Subject:      Re: Merge/coding problem using index, find,
              or some other SAS function (with have and need data)
Comments: To: Paul Miller <pjmiller_57@YAHOO.COM>
In-Reply-To:  <1322597023.60249.YahooMailClassic@web161601.mail.bf1.yahoo.com>
Content-Type: text/plain; charset="us-ascii"

I am eager to know as well. It seems to me that your problem need to be solved using Cartesian approach, and SQL happens to be the native tool for that. Without common key variables, I don't see any advantages of datastep over SQL.

Kindly Regards, Haikuo -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Paul Miller Sent: Tuesday, November 29, 2011 3:04 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Merge/coding problem using index, find, or some other SAS function (with have and need data)

Hello Everyone,

Actually, I don't think my solution will work. The problem is that I have a huge dataset that needs to be coded, and my solution doesn't scale well.

Is there a more efficient way of doing this?

Thanks,

Paul

--- On Tue, 11/29/11, Paul Miller <pjmiller_57@yahoo.com> wrote:

> From: Paul Miller <pjmiller_57@yahoo.com> > Subject: Re: Merge/coding problem using index, find, or some other SAS function (with have and need data) > To: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> > Received: Tuesday, November 29, 2011, 1:57 PM > Hello Everyone, > > Think I found the solution. It looks like I need to use the > indexw function as in the code below. > > Thanks, > > Paul > > proc sql; > create table test as > select * > from drugs as d left > join names as n > on > indexw(lowcase(desc), lowcase(names), " /") > 0; > quit; > > > --- On Tue, 11/29/11, Paul Miller <pjmiller_57@yahoo.com> > wrote: > > > From: Paul Miller <pjmiller_57@yahoo.com> > > Subject: Merge/coding problem using index, find, or > some other SAS function (with have and need data) > > To: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> > > Received: Tuesday, November 29, 2011, 1:37 PM > > Hello Everyone, > > > > I have some data about chemotherapy and other medical > > procedures in a variable (called "desc") in one of my > > datasets. I want to code whether or not each entry in > this > > variable is chemotherapy using information from a > variable > > in another dataset (called "names"). > > > > Often, the lowcase() version of the variables matches > and > > so linking and coding are easy. In some cases though, > the > > variable I'm trying to code is a longer string and I > need to > > determine if the chemotherapy name in the second > variable is > > somewhere inside it. An added complication is that > "desc" > > can match more than one value in "names," but I don't > want > > to wind up with multiple rows for "desc" whenever this > is > > the case. > > > > I've provided some sample data below to illustrate > what I'm > > trying to do. I've been trying to link the rows using > proc > > sql and the index function but am unable to link > properly > > for strings like "5FU/Fluorouracil" and "Leucovorin > > Calcium." > > > > Is there some easy way to get the result I need? > > > > Thanks, > > > > Paul > > > > > > data drugs; > > input desc $ 1-25; > > cards; > > Venipuncture > > Ondansetron > > Bevacizumab > > Carboplatin > > 5FU/Fluorouracil > > Leucovorin Calcium > > ; > > run; > > > > data names; > > input names $ 1-25; > > cards; > > Bevacizumab > > Carboplatin > > 5FU > > Leucovorin > > ; > > run; > > > > data need; > > length desc $ 25; > > input desc $& chemo $; > > cards; > > Venipuncture No > > Ondansetron No > > Bevacizumab Yes > > Carboplatin Yes > > 5FU/Fluorouracil Yes > > Leucovorin Calcium Yes > > ; > > run; > > > ----------------------------------------- Email messages cannot be guaranteed to be secure or error-free as transmitted information can be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The Centers for Medicare & Medicaid Services therefore does not accept liability for any error or omissions in the contents of this message, which arise as a result of email transmission.

CONFIDENTIALITY NOTICE: This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to which it is addressed. Any review, dissemination, or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message.


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