Date: Mon, 19 Jun 2006 11:31:41 -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: <8C861DCA7CB963B-84-B425@FWM-M29.sysops.aol.com>
Content-Type: text/plain; charset="utf-8"
Thank ken for the clarification.
So it seems that the best bet is to use the _n_=1 method to make sure the bases are always covered. That's what I needed to know.
Alan
Alan Churchill
Savian "Bridging SAS and Microsoft Technologies"
www.savian.net
-----Original Message-----
From: evilpettingzoo97@aol.com [mailto:evilpettingzoo97@aol.com]
Sent: Monday, June 19, 2006 11:27 AM
To: SASL001@savian.net; SAS-L@LISTSERV.UGA.EDU
Subject: Re: Do regular expressions need to be declared in _n_=1
Alan,
The compile once behavior of the PRX functions occurs if you use the /o modifier or in WHERE expressions. The /o modifier may not take in some cases when performing substitutions (with PRXCHANGE). Other than that, the other options are if _n_=1 & retain or a DoW loop.
HTH,
Ken
-----Original Message-----
From: Alan Churchill <SASL001@SAVIAN.NET>
To: SAS-L@LISTSERV.UGA.EDU
Sent: Mon, 19 Jun 2006 10:53:59 -0600
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
________________________________________________________________________
Check out AOL.com today. Breaking news, video search, pictures, email and IM. All on demand. Always Free.