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 (October 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 7 Oct 2009 10:54:37 +0200
Reply-To:     Daniel Fernández <fdezdan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Daniel Fernández <fdezdan@GMAIL.COM>
Subject:      Re: extract portion from string
Comments: To: Kevin Myers <KevinMyers@austin.rr.com>
In-Reply-To:  <B32811B8D6804EECA216194BA759D169@KAM1720>
Content-Type: text/plain; charset=ISO-8859-1

Kevin´s method is fine.Other method is using scan function:

data have; input emails $50.; cards; I@napier.ac.uk P.Bhardwaj@napier.ac.uk Scott@rbs.co.uk Alan@rbs.co.uk abc@s.com ; run;

data need; set have; name=scan(emails,1,'@'); run;

Daniel Fernández. Barcelona

2009/10/7 Kevin Myers <KevinMyers@austin.rr.com>: > p=index(MyData,"@"); > if p>1 then want=substr(MyData,1,p-1); > else want=""; > > ----- Original Message ----- > From: "SUBSCRIBE SAS-L Joe H. Smith" <peesari.mahesh@GMAIL.COM> > To: <SAS-L@LISTSERV.UGA.EDU> > Sent: Wednesday, October 07, 2009 01:43 > Subject: extract portion from string > > >> hi all, >> >> i have to extract some part from portion of string, >> >> My data: >> I@napier.ac.uk >> P.Bhardwaj@napier.ac.uk >> Scott@rbs.co.uk >> Alan@rbs.co.uk >> abc@s.com >> >> want: >> I >> P.Bhardwaj >> Scott >> Alan >> abc >> >> Thanks >> >


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