Date: Mon, 19 Jun 2006 11:19:25 -0600
Reply-To: Alan Churchill <SASL001@SAVIAN.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Alan Churchill <SASL001@SAVIAN.NET>
Subject: Re: Do regular expressions need to be declared in _n_=1
In-Reply-To: <A4F0DBF1F84D4F46A0E6D56405D3511989E242@HHAEXMB03.rf01.itservices.ca.gov>
Content-Type: text/plain; charset="us-ascii"
Thanks Paul.
The examples show the use of _n_=1 but I thought that the speaker there said
this was changed in version 9 so that it wouldn't be necessary. All the
examples show the use of _n_=1 which I would expect. However, I seem to
recall specifically that they said it wouldn't be needed.
The question I have is whether it is necessary and, if not, what version of
SAS were they referring to? 9.13 or 9.2?
Alan
Alan Churchill
Savian "Bridging SAS and Microsoft Technologies"
www.savian.net
-----Original Message-----
From: Choate, Paul@DDS [mailto:pchoate@DDS.CA.GOV]
Sent: Monday, June 19, 2006 11:10 AM
To: Alan Churchill; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Do regular expressions need to be declared in _n_=1
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