Date: Fri, 8 Jun 2007 13:23:13 -0400
Reply-To: Peter Flom <peterflomconsulting@mindspring.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Flom <peterflomconsulting@MINDSPRING.COM>
Subject: Reading a weird date format
Content-Type: text/plain; charset=UTF-8
Hello
I have an Excel file with a column of dates that are oddly formatted.
e.g.
38 Oct 11-15
38 Oct 19-24
38 Nov 7-12
38 is 1938, the next 3 are the month, the end is a range of dates in the month. Sometimes the range extends over 2 months
39 Feb 24 - Mar 1
This is a character field in Excel.
I used dbmscopy to convert it to SAS, yielding
e.g.
38 Oct 11-15
so, then I tried the substr function to get year, month, and startdate and enddate, figuring I could then recombine them.
<<<
data today;
set kos.presapp;
year = substr(date, 1,2);
month = substr(date, 4, 4);
startday = substr(date, 5,5);
where date ne '';
run;
>>>
yields less than ideal results (year and month are ok but...)
startday looks like
ct 11
changing 5,5 to 7,7 yields somewhat better results:
e.g
1-3
but that's still not good.
date got read as a length 18 character variable.
How does one character yield 3?
How to read this?
TIA
Peter