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 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 1 Dec 2010 18:03:10 -0800
Reply-To:     art297 <atabachneck@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         art297 <atabachneck@GMAIL.COM>
Subject:      Re: A Match question. Thanks.
Content-Type: text/plain; charset=ISO-8859-1

Why don't you just use eq ? E.g.,

data old; input var $; cards; ABBOTT ABBOTT ABBOTT ABBOTT ABB ABB ABB ;

data want; set old; where var eq "ABB"; run;

Art ------------ On Dec 1, 4:49 pm, CC <chchanghe...@gmail.com> wrote: > Hello all, > > I have a question regarding the matching procedure. The are two > companies for instance: > ABBOTT > ABBOTT > ABBOTT > ABBOTT > ABB > ABB > ABB > > For example, if I want to keep ABB and use the "contains" or "index" > function to search for variables that contains "ABB", I will still > have to keep observations having ABBOTT since it also contains "ABB" > > So, my code will like this. > > data want; > set old; > where var contains "ABB"; /* or I use if index(var, "ABB") > 0*/ > run; > > Using this code, I will not only get observations having "ABB" but > also observations having "ABBOTT". Is there anyway I can do to only > keep observations having "ABB"? Thanks a lot!


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