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 (March 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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); INFILE ascii; IF _N_ = 1 THEN INPUT dummy $CHAR8. @@; INPUT year 4. dummy $CHAR1. first $CHAR4. dummy $CHAR1. last $CHAR5 class 1. dummy $CHAR1. @@; RUN;

-----Original Message----- From: Ken Gim [mailto:1800okla@HANMAIL.NET] Sent: Tuesday, March 09, 2004 11:29 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Data Input Problem 2

Hello,

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 space 1 FIRST 4 CHAR space 1 LAST 5 CHAR CLASS 1 NUMBER space 1

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.

INPUT file =================== 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


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