Date: Wed, 22 Mar 2000 11:08:04 -0800
Reply-To: "Chastain Research Group, Inc. (ChRG)" <bob@CHASTAIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chastain Research Group, Inc. (ChRG)" <bob@CHASTAIN.COM>
Subject: Re: A Read infile problem. Please Help Me.
In-Reply-To: <38D8A53C.B5DB08E6@hongkong.com>
Content-Type: multipart/alternative;
Antonio,
In the example you gave, you can use either:
PAD
INFILE 'c:\TMP' PAD;
* padded with blanks with length LRECL= (r 50 characters in your example
without LRECL= option) making it work like a fixed-length record file
or TRUNCOVER
INFILE 'c:\TMP' TRUNCOVER;
* Using the TRUNCOVER option enables you to read variable-length records
when some records are shorter than expected.
By default, the INPUT statement reads the next record automatically.
MISSOVER option will have no effect in your example even with blank records
At 06:49 PM 3/22/00 +0800, wong wrote:
>Hi Friends,
>
>I would like to ask a question about reading external file.
>Suppose I have the following datafile:
>
>line 1: Mary Chan Wan Kwan <End of line>
>line 2: John Wong Yiu <End of line>
>line 3: Bill Gates<End of line>
>
>I try to read this with the following code:
>
>DATA TMP;
>INFILE 'c:\tmp';
>INPUT NAME $ 1-50;
>
>The maxium length of these NAME is 50. But most names are shorter less
>than 50. My program fail to read the file. There are 11000 obs in the
>file but only 3000 obs are read. I hope someone are so kind to teach me
>how to read this file. Thank you very much in advance.
>
>Morevoer, please let me know if you know which SAS book contains many
>READ sample code.
>
>Best,
>Antonio
[text/html]
|