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 16:29:26 -0400
Reply-To:   Mark Lamias <Mark.Lamias@GRIZZARD.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mark Lamias <Mark.Lamias@GRIZZARD.COM>
Subject:   Re: Data with Carriage return where I don't want it.
Comments:   To: Ian Whitlock <WHITLOI1@WESTAT.COM>
Content-Type:   text/plain; charset="iso-8859-1"

Can't you simply compress the ASCII text character for the carriage return ('OD'x) out of the variable after reading in the file?

Sincerely yours,

Mark J. Lamias

-----Original Message----- From: Ian Whitlock [mailto:WHITLOI1@WESTAT.COM] Sent: Friday, September 12, 2003 4:25 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Data with Carriage return where I don't want it.


Thanks for the needed correction.


-----Original Message----- From: Howard Schreier [mailto:Howard_Schreier@ITA.DOC.GOV] Sent: Friday, September 12, 2003 4:15 PM To: SAS-L@LISTSERV.UGA.EDU; Ian Whitlock Subject: Re: Data with Carriage return where I don't want it.

I was thinking along the same lines. I suggest the following modifications to the first DATA step, to avoid duplicate observations, to handle wrapping beyond a second line, and to pick up the last observation:

Code END=DONE on the INFILE statement. This precludes the use of inline (CARDS;) data. Instead the records must be in an external file.

Eliminate the first PUT statement.

Insert the statements

if done then put line; run;

at the end.

On Fri, 12 Sep 2003 15:04:19 -0400, Ian Whitlock <WHITLOI1@WESTAT.COM> wrote:

>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 ; > > >-----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