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 11:37:50 -0800
Reply-To:   Paul Miller <pjmiller_57@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Paul Miller <pjmiller_57@YAHOO.COM>
Subject:   Merge/coding problem using index, find, or some other SAS function (with have and need data)
In-Reply-To:   <201111290600.pAT1K3PL024465@willow.cc.uga.edu>
Content-Type:   text/plain; charset=us-ascii

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;


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