Date: Tue, 9 Mar 2004 13:17:01 -0800
Reply-To: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject: Re: Data Input Problem 2
Content-Type: text/plain; charset="iso-8859-1"
If the ASCII file has no carriage returns or new line characters, how can it have 1024 characters per line? What is a line in this context?
If what you really have is a continuous stream that consists of one 8-byte block and numerous 17-byte blocks, then the following may work:
DATA output (KEEP = year first last class);
IF _N_ = 1 THEN
INPUT dummy $CHAR8. @@;
INPUT year 4.
From: Ken Gim [mailto:1800okla@HANMAIL.NET]
Sent: Tuesday, March 09, 2004 11:29 AM
Subject: Data Input Problem 2
Would you kindly help me code this so that I can generate the desired
OUTPUT file ?
The input ASCII file has total fixed length of 1024 per line
(with no carriage-return or new line characters).
The following 4 fields are in each record (17 bytes) in INPUT file.
Field Name Width Type
YEAR 4 NUMBER
FIRST 4 CHAR
LAST 5 CHAR
CLASS 1 NUMBER
Please note that the first 8 bytes are blank and the YEAR starts from
the 9th column in the first line of INPUT file.
I don't know how to handle the first 8 bytes of blank in the first line,
which bothers me.
Thank you very much for your time and effort in advance.
2001 John Smith8 2003 Mary Potts1 [.........] 1998 WINA PRI
CE2 1998 Mark Water2
[.........] above means that the data of the same format continue.
Column 1017 in the first line : W
Column 1018 in the first line : I
Column 1019 in the first line : N
Column 1020 in the first line : A
Column 1021 in the first line : space
Column 1022 in the first line : P
Column 1023 in the first line : R
Column 1024 in the first line : I
desired OUTPUT file
2001 John Smith 8
2003 Mary Potts 1
1998 WINA PRICE 2
1998 Mark Water 2