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 (August 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 6 Aug 2010 14:06:42 -0400
Reply-To:     "Teed, Lionel" <Lionel.Teed@TD.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Teed, Lionel" <Lionel.Teed@TD.COM>
Subject:      Re: What do we have to do to SAVE SAS-L
In-Reply-To:  <201008061710.o76GpYms010178@willow.cc.uga.edu>
content-type: text/plain; charset="ISO-8859-1"

Well...

My thanks to both Toby and Art for the solutions provided. Toby's link's were very helpful. Art, as a fellow Canadian, provided a truly customized solution designed to identify the unique 'gotchas' inherent in the Canadian Postal Code numbers.

Even Santa's postal code, H0H0H0 would be captured by the solution!

Lionel

-----Original Message----- From: Arthur Tabachneck [mailto:art297@NETSCAPE.NET] Sent: Friday, August 06, 2010 1:10 PM To: SAS-L@LISTSERV.UGA.EDU; Teed, Lionel Subject: Re: What do we have to do to SAVE SAS-L

Lionel,

Toby is definitely more well versed than I am regarding regular expressions, but I'd think that you have to account for both "ANANAN" and "ANA NAN". There might be an easier way to state it, but the following will find both:

data have; informat string $35.; input string &; cards; 123 e north street toronto MMMJJJ 123 s east street toronto LLLKKK 123 e north street toronto M2J 5B5 123 s east street toronto L3T 5K9 123 e north street toronto M2J5B5 123 s east street toronto L3T5K9 ;

data want; set have; if _n_ eq 1 then do; Pattern1 = "[ABCEGHJ-NPRSTVXYZ]\d[A-Z]* \d[A-Z]\d"; Pattern2 = "[ABCEGHJ-NPRSTVXYZ]\d[A-Z]\d[A-Z]\d"; patternID = prxparse("/" !! Pattern1 !! "|" !! Pattern2 !! "/"); end; retain patternID; position=prxmatch(patternID,string); run;

Art ---------- On Fri, 6 Aug 2010 13:30:31 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:

>Lionel, > >Much would depend on what all else is in your string. But lets assume the following: > >1.) the beggining and ending of the postal code is seperated from the other 32 characters by a space >2.) the pattern you are looking for follows the Canadian postal code schema of [char][digit][char][space][digit][char][digit] > > >'/(?: [a-z]\d[a-z] \d[a-z]\d )/io' > >You might be able to get away with using the zero assertion \b to denote the beggining and ending of your pattern string >'/(?:\b[a-z]\d[a-z] \d[a-z]\d\b)/io'

******************** NOTICE OF CONFIDENTIALITY This communication including any information transmitted with it is intended only for the use of the addressees and is confidential. If you are not an intended recipient or responsible for delivering the message to an intended recipient, any review, disclosure, conversion to hard copy, dissemination, reproduction or other use of any part of this communication is strictly prohibited, as is the taking or omitting of any action in reliance upon this communication. If you receive this communication in error or without authorization please notify us immediately by return e-mail or otherwise and permanently delete the entire communication from any computer, disk drive, or other storage medium.

If the above disclaimer is not properly readable, it can be found at www.td.com/legal

AVERTISSEMENT DE CONFIDENTIALITE Ce courriel, ainsi que tout renseignement ci-inclus, destiné uniquement aux destinataires susmentionnés, est confidentiel. Si vous n'êtes pas le destinataire prévu ou un agent responsable de la livraison de ce courriel, tout examen, divulgation, copie, impression, reproduction, distribution, ou autre utilisation d'une partie de ce courriel est strictement interdit de même que toute intervention ou abstraction à cet égard. Si vous avez reçu ce message par erreur ou sans autorisation, veuillez en aviser immédiatement l'expéditeur par retour de courriel ou par un autre moyen et supprimer immédiatement cette communication entière de tout système électronique.

Si l'avis de non-responsabilité ci-dessus n'est pas lisible, vous pouvez le consulter à www.td.com/francais/legale


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