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 (September 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 12 Sep 2003 15:04:19 -0400
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: Data with Carriage return where I don't want it.
Content-Type: text/plain

jsl,

I would make it a two step process, one to fix the file and one t read the fixed file. This works with the data given. You may need to change lengths when more data is considered. If one logical record is more than two lines then the first step will need more changes.

filename temp temp ; data _null_ ; length line $ 200 ; retain line ; infile cards firstobs = 2 ; input ; file temp ; if substr(_infile_,1,2) ^= " " then do ; line = trim(line) || _infile_ ; put line ; end ; else do ; if _n_ > 1 then put line ; line = left(_infile_) ; end ; cards ; .......... ;

data w ; infile temp dsd dlm = "/" ; input name :$30. age :5. title :$70. remuneration :$20. ; run ;

IanWhitlock@westat.com -----Original Message----- From: jsl [mailto:nospam@NOSPAM.COM] Sent: Friday, September 12, 2003 2:44 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Data with Carriage return where I don't want it.

I have a very large "text file" data set that has a bunch of pockets of information that looks like the attached text file. I have been able to read it just fine for the most part keying off words in the first line, but I can't figure out the easiest way to deal with the unwanted hard return. That is, given the source of the data, I have no control over the unwanted carriage return within a record. However, I do know that the first two columns are always blank unless it's a record that wrapped. Anybody have simple suggestion on how to keep those lines together? Thanks, Jim


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