Date: Thu, 2 Dec 2010 09:40:59 -0500
Reply-To: shyamprasad samisetti <shyam.cbz@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: shyamprasad samisetti <shyam.cbz@GMAIL.COM>
Subject: Re: A Match question. Thanks.
In-Reply-To: <99ce4e8a-e825-46c7-9c87-2cab26b20526@w29g2000vba.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Art,
Try using wild cards in Sql.
Proc Sql;
Create Table New As
Select *
From Old
Where Upcase(Var) like '%ABB';
Quit;
Hope this serves.
Shyam.
On Wed, Dec 1, 2010 at 9:03 PM, art297 <atabachneck@gmail.com> wrote:
> 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!
>
|