Date: Fri, 8 Dec 2006 12:37:35 -0800
Reply-To: plw213 <Paul.Leland@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: plw213 <Paul.Leland@GMAIL.COM>
Organization: http://groups.google.com
Subject: Parsing dates with prxparse
Content-Type: text/plain; charset="iso-8859-1"
OK -I am at my wits end!!
Can anyone tell me why this doesn't work to parse out mm, dd, and yyyyy
out of a character string for dates formatted mm/dd/yyyy or m/d/yyyy
(when month or date is less than) 10?
All I get is blanks for the prxposn results:
data medimpact_demog ;
infile medimp dsd dlm='09'x firstobs=2 ;
retain re_date ; if _n_=1 then
re_date=prxparse("/(\d{1,2})\/(\d{1,2})\/(\d{4})/") ;
length
DOB_string $10
.
.
.
;
input
DOB_string : $
.
.
;
dob_string=compress(dob_string) ;
dob=mdy(prxposn(re_date,1,dob_string) , prxposn(re_date,2,dob_string) ,
prxposn(re_date,3,dob_string)) ;
mm=prxposn(re_date,1,dob_string) ;
dd=prxposn(re_date,2,dob_string) ;
yy=prxposn(re_date,3,dob_string) ;
run;
|