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 (May 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 20 May 2009 23:13:05 -0700
Reply-To:   Daniel Nordlund <djnordlund@VERIZON.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Daniel Nordlund <djnordlund@VERIZON.NET>
Subject:   Re: Whats problem with this program ?
In-Reply-To:   <101ca221-96fd-4193-9eb9-15b1cae7ff01@y6g2000prf.googlegroups.com>
Content-type:   text/plain; charset=iso-8859-1

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of naga > Sent: Wednesday, May 20, 2009 10:32 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Whats problem with this program ? > > Hi all > pls find mistake and give me explanation > > data one; > input jdate date9. @@; > format jdate ddmmyy10.; > datalines; > 12jan2007 13jan2007 14jan2007 15jan2007 > ; > proc print; > run;

The problem is that using formatted input as above, the input reads exactly 9 characters each time, so the first time it reads '12jan2007' (without the quotes), then it reads ' 13jan200', then '7 12jan20', and lastly I reads '07 12jan2'. I won't go into the hoary details of SAS date interpretation (there has been plenty of discussion on SAS-L). Suffice it to say the first was read correctly, the second has an invalid year, the third and fourth ignore what are presumed to be extraneous numbers. You can solve the problem by using

input jdate :date9. @@;

I believe the extra records with missing values are a result of the '@@' holding the single input record and a default LRECL=80 for card input.

Hope this is helpful,

Dan

Daniel Nordlund Bothell, WA USA


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