Date: Mon, 19 Jun 2006 10:09:51 -0700
Reply-To: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject: Re: Do regular expressions need to be declared in _n_=1
In-Reply-To: <00d101c693c0$f6de3740$e49aa5c0$@net>
Content-Type: text/plain; charset="us-ascii"
The search and extract section of the tip sheet confirm this:
http://support.sas.com/rnd/base/topics/datastep/perl_regexp/regexp-tip-s
heet.pdf
as do the examples here:
http://support.sas.com/rnd/base/topics/datastep/perl_regexp/regexp.motiv
ation.html#Examples
hth
Paul Choate
DDS Data Extraction
(916) 654-2160
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Alan
> Churchill
> Sent: Monday, June 19, 2006 9:54 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Do regular expressions need to be declared in _n_=1
>
> All,
>
> I seem to recall at the last SUGI that regular expression patterns are
> automatically retained and are only processed once in a data step. For
> example,
>
> Old Way:
>
> Data test ;
> Infile 'something or other' ;
> Input;
> Retain pattern ;
> If _n_ = 1 then
> Do ;
> Pattern = prxparse("/some regex/") ;
> End;
> Run ;
>
>
> Optional way:
>
> Data test ;
> Infile 'something or other' ;
> Input;
> Pattern = prxparse("/some regex/") ;
> Run ;
>
>
> Can anyone confirm this?
>
> Thanks,
> Alan
>
> Alan Churchill
> Savian "Bridging SAS and Microsoft Technologies"
> www.savian.net
|