Date: Wed, 18 Jun 2003 22:27:08 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: Time informat
I see a couple of problems.
The time informat is only bound to BEGIN2. You can use parentheses to
remedy that.
input (begin1-begin2) (time8.);
There are also traps involved in combining list style (delimited) input
with informats. The modified INPUT statement shown above will look for
BEGIN2 starting in column 9 (where the comma is). One solution:
input (begin1-begin2) (:time8.);
Or
informat begin1-begin2 time8.;
input begin1-begin2;
All of the above untested.
On Wed, 18 Jun 2003 17:48:17 -0700, Tyler Barbour <sim7396@HOTMAIL.COM>
wrote:
>I'm having a hard time reading a time variable (hh:mm:ss) from a text
>file with comma-sparated values. This is an example:
>
>Submitted lines:
>
>data one;
> infile cards DLM=',';
> input begin1-begin2 time8.;
> cards;
>15:00:34,15:00:17
> ;
>run;
>
>The log says:
>
>289 data one;
>290 infile cards DLM=',';
>291 input begin1-begin2 time8.;
>292 cards;
>NOTE: Invalid data for begin1 in line 293 1-8.
>RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----
+--
>293 15:00:34,15:00:17
>begin1=. begin2=54017 _ERROR_=1 _N_=1
>NOTE: The data set WORK.ONE has 1 observations and 2 variables.
>NOTE: DATA statement used:
> real time 0.00 seconds
> cpu time 0.00 seconds