Date: Tue, 29 Dec 1998 16:30:27 GMT
Reply-To: DNordlund <dnordlund@AOL.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: DNordlund <dnordlund@AOL.COM>
Organization: AOL http://www.aol.com
Subject: Re: Excel and Dates
Bernie Zimmerman wrote:
>
>I've been given a group of files, about 10 files with ~ 200K records in
>each, to process in SAS. The files come from MS Excel and (almost) always
>consist of a phone number, a blank column, and a character date equivalent.
>Some examples might be:
>
>2012211234 7/11/98
>2123313456 8/18/98
>4156782222 10/5/98 .
>
>I've tried reading these ascii/flat/text files into SAS, but I'm unable to
>treat the "date" column successfully. Here is the code I used:
>
>filename flat1 '/workd10/greta/cell8' ;
>
>data abc ;
>
> infile flat1 lrecl= 500 dlm= '09'x ; /* TAB delimited */
> input phone $10. prov_ch $8. ;
>
> prov_da= input(prov_ch, mmddyy8.) ;
>
>drop prov_ch ;
>run ;
>
>proc print data= abc(obs= 25); run ;
>
>
>The value for prov_da for all values is always "missing".
>
>Is there something obvious that I'm overlooking?
>Hope to hear from someone soon.
>
>TIA
>
>
Bernie,
you might try adding a length statement and changing the input statement as
follows:
1. right after the DATA ABC statement add
length phone $10 provch $8;
2. change your input statement to
input phone prov_ch;
I believe your input statement was reading the first 10 columns into phone, and
then immediately encountered a tab when trying to read prov_ch. I think you
want to use list input when you have delimited data. The length statement will
initialize your variables to the length that you want.
Hope this helps,
Dan Nordlund
|