Date: Mon, 3 Jul 2006 13:30:23 -0700
Reply-To: Amir Behbehani <docwriter@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Amir Behbehani <docwriter@GMAIL.COM>
Subject: Re: parse character field
In-Reply-To: <BAY101-F289AE88952D852B2550219DE700@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi Toby,
Okay, I have the following code now to parse out the character field. It
will parse the following strings very well:
Oracle BPEL Process Manager 10.1.2.0.2 Win NT 4.0/2000
and
Oracle Database Enterprise Edition 9.2.0.1 Win NT 4.0/2000
and
Oracle HTML DB 2.0 Java
but it won't parse these strings:
Oracle Database 10g Express Edition 10.2.0.1/Client Win NT 4.0/2000
or
Oracle JDeveloper (Studio) 10.1.3 Java
or
Struts (doc) 10.1.3.0.4.0 Java
Please advise. Here is the code:
**
*data* bam._parseme (drop=_: ) ;
set bam.parsed_new ;
retain _re ;
if _n_=*1* then do ;
_re=prxparse('/^([a-z ]+)\s+([\d\.]+)\s(.+)/i') ;
if missing(_re)=*1* then stop;
end;
_match=prxmatch(_re, Description) ; * starting position of match ;
array part[*3*] $*30* Product Version Platform ;
if _match then do _i=*1* to *3* ;
* Extract the contents of each of the three buffers/backreferences ;
part[_i]=prxposn(_re, _i, Description) ;
end ;
*
run* ;