LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 10 Jun 2007 19:35:22 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Reading a weird date format

On Fri, 8 Jun 2007 13:46:21 -0400, Peter Flom <peterflomconsulting@MINDSPRING.COM> wrote:

>Thanks! > >SCAN worked perfectly

Does it handle the cases which span months (39 Feb 24 - Mar 1)?

Do you have cases which span years (42 Dec 22 - 43 Jan 6)?

Look into the YRCUTOFF option for handling the 2-digit years.

> >Peter > >-----Original Message----- >>From: Nathaniel.Wooding@dom.com >>Sent: Jun 8, 2007 1:39 PM >>To: Peter Flom <peterflomconsulting@mindspring.com> >>Cc: SAS-L@LISTSERV.UGA.EDU >>Subject: Re: Reading a weird date format >> >>Peter >> >>I would use SCAN rather than SUBSTR >> >>Data Peter; >> input string $ 1-15; >> year=scan(string,1); >> month=scan(string,2); >> sday=scan(string,3); >> cards; >>38 Oct 11-15 >>38 Oct 19-24 >>38 Nov 7-12 >>Proc print; >>run; >> >>Nat >> >>Nat Wooding >>Environmental Specialist III >>Dominion, Environmental Biology >>4111 Castlewood Rd >>Richmond, VA 23234 >>Phone:804-271-5313, Fax: 804-271-2977 >> >> >> >> Peter Flom >> <peterflomconsult >> ing@MINDSPRING.CO To >> M> SAS-L@LISTSERV.UGA.EDU >> Sent by: "SAS(r) cc >> Discussion" >> <SAS-L@LISTSERV.U Subject >> GA.EDU> Reading a weird date format >> >> >> 06/08/2007 01:23 >> PM >> >> >> Please respond to >> Peter Flom >> <peterflomconsult >> ing@mindspring.co >> m> >> >> >> >> >> >> >>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 >> >> >> >>----------------------------------------- >>CONFIDENTIALITY NOTICE: This electronic message contains >>information which may be legally confidential and/or privileged and >>does not in any case represent a firm ENERGY COMMODITY bid or offer >>relating thereto which binds the sender without an additional >>express written confirmation to that effect. The information is >>intended solely for the individual or entity named above and access >>by anyone else is unauthorized. If you are not the intended >>recipient, any disclosure, copying, distribution, or use of the >>contents of this information is prohibited and may be unlawful. If >>you have received this electronic transmission in error, please >>reply immediately to the sender that you have received the message >>in error, and delete it. Thank you. >>


Back to: Top of message | Previous page | Main SAS-L page