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 (July 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 27 Jul 2006 06:42:03 -0400
Reply-To:     Nathaniel_Wooding@DOM.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <Nathaniel_Wooding@DOM.COM>
Subject:      Re: Operator like "contains"
Comments: To: Kiran_N <Kiran_N@SATYAM.COM>
In-Reply-To:  <D8595042F3765A4285B848A78A2C2ED105301857@bsdmsg002.corp.satyam.ad>
Content-Type: text/plain; charset="US-ASCII"

Saurabh

Here is a modified solution that uses a scan function to grab the year/month values. Also, I used one of the indexw solutions that had been offered but modified it by removing the third operator. V8 does not allow a third operator.

Nat Wooding

data temp; infile cards; input name $ :name2 $20.; if ( indexw(compbl(name2),"Canton" )>=1 or indexw(compbl(name2),"Ohio" )>=1) then delete; newname=scan(name2,-1); cards; A May06 Canton B Canton June06 C Oct06 D Ohio June06 E Ohio May06 F Jan06 ; proc print; run;

Kiran_N <Kiran_N@SATYAM.C OM> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-L@LISTSERV.U GA.EDU> Subject Re: Operator like "contains"

07/27/2006 06:07 AM

Please respond to Kiran_N <Kiran_N@SATYAM.C OM>

Hi Saurabh,

Just change the word to delete instead of output and you will get what you desired.

data temp; infile cards; input name $ :name2 $20.; if (indexw(compbl(name2),"Canton"," ")>=1 or indexw(compbl(name2),"Ohio"," ")>=1) then delete; cards; A May06 Canton B Canton June06 C Oct06 D Ohio June06 E Ohio May06 F Jan06 ; run;

Cheers! N K Kiran Satyam Computers Services Limited, Bangalore.

-----Original Message----- From: Das, Saurabh (GE Cons Fin, consultant) [mailto:saurabh.das@GECIS.GE.COM] Sent: Thursday, July 27, 2006 3:27 PM To: SAS-L@LISTSERV.UGA.EDU; Kiran_N Cc: Das, Saurabh (GE Cons Fin, consultant) Subject: Re: Operator like "contains"

Hi ,

Thanks for your response, however I think I might be not be communicating it properly, apologies for it..... ok

heres the dataset >Name Name2 >A Canton May06 >B Canton June06 >C Oct06 >D Ohio June06 >E Ohio May06 >F Jan06

Now the new dataset which I would want shoudl be like this

Name Name2 C Oct06 F Jan06

I think telling filtering out may have put us in the wrong track ...

On Thu, 27 Jul 2006 15:19:47 +0530, Kiran_N <Kiran_N@SATYAM.COM> wrote:

>Hi Saurabh, > >Hope the following helps you. > >data temp; > infile cards; > input name $ :name2 $20.; > if (indexw(compbl(name2),"Canton"," ")>=1 or > indexw(compbl(name2),"Ohio"," ")>=1) then output; > cards; >A May06 Canton >B Canton June06 >C Oct06 >D Ohio June06 >E Ohio May06 >F Jan06 >; >run; > >Thanking you and Best Regards, >N K Kiran > >" A rock may change the river's course, > but it does not change the river ! >" > > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >saurabh d >Sent: Thursday, July 27, 2006 2:07 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Operator like "contains" > >Hi All, > >I am a newbie and would like an operator like a contains. My basic >objective is drop all values which contains a certain type of string in >a >column . The comparison operators and logical operators , I am not able >to >work with them . Would you be having any idea. > >eg of colum > >Name Name2 >A Canton May06 >B Canton June06 >C Oct06 >D Ohio June06 >E Ohio May06 >F Jan06 > >I would like to filter out all Canton and Ohio variables . Hope that >makes >it clear. > >thanks Saurabh > > > >DISCLAIMER: >This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

DISCLAIMER: This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

----------------------------------------- CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and/or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.


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