We are using PERL regular
expression.
We are using 3 functions
prxparse,prxmatch and prxposn.
Prxparse takes regularexpression and
retutns a pattern identification number for the compiled regular
expression.
Prxmatch takes a pattern identification
numbar and character value and return the position where the
egularexpression finds a match
prxposn returns a value for captured
buffer.
data Names; input name $32.; datalines; Raj Gupta Sam Mark Jenny Derak John Michel ; run; data FirstLastNames; length first last $ 16; keep first last; retain re; if _N_ = 1 then re = prxparse('/(\w+)\s(\w+)/'); set Names; if prxmatch(re, name) then do; last = prxposn(re, 1, name); first = prxposn(re, 2, name); end; run;