Date: Tue, 23 Nov 2004 10:35:41 -0800
Reply-To: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject: Re: SAS Function
Jules - Some random thoughts -
In v9 it seems like a perfect use for Perl regular expressions - here are
some SAS.com papers http://xrl.us/d4ru .
Index would work, but only returns the first, so you'd need to successively
substring your text. Probably simpler would be (if your dates are always
delimited within the strings) scanning the sub-elements through a date
informat (untested):
array date{15};
j=1;
i=1
do (while scan(var,i) ne '');
if input(scan(var,i),date.) ne . then do;
date(j)= input(scan(var,i),date.);
j+1;
i+1;
end; end;
hth
Paul Choate
DDS Data Extraction
(916) 654-2160
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Bosch,
Jules
Sent: Tuesday, November 23, 2004 7:30 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: SAS Function
SAS V8
I have no documentation at the moment but need to read a string seeking date
occurrences (format=ddmmmyy or ddmmmyyyy). Often there is more than one
date in the string. I think the INDEXC function should work but don't know
if it will locate each occurrence of an excerpt or just the first. Any
suggestions would be greatly appreciated?
TIA,
Jules Bosch
*********************************************************************
This message and any attachments are solely for the intended recipient. If
you are not the intended recipient, disclosure, copying, use or distribution
of the information included in this message is prohibited -- Please
immediately and permanently delete.
|