Date: Wed, 28 Dec 2005 22:03:26 -0800
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: Can this be solved by INFILE and INPUT alone?
In-Reply-To: <200512280605.jBS5iDMq019149@mailgw.cc.uga.edu>
Content-Type: text/plain; format=flowed
dubro@DOLIC.DE wrote back:
>Dear Ed,
>
>thank you for this idea. There is a reason why this (to my knowledge)
>can't work. I forgot to
>mention that the data eventually can be very long. That is the reason
>why I put the LRECL to
>maximum. The maximum value for automatic variable _INPUT_ is 32,767
>which is far less than I need.
>Maybe I should think about a workaround.
One work-around you might consider is throwing Perl at your infile. (I'm
sure many
readers are *shocked* that I suggest Perl. :-)
Here is some TOTALLY UNTESTED Perl code which might solve your problem.
It translates all '(' into a space and all ')' into a newline. This should
be platform
independent, up to the choice of the type of quotes.
perl -0777pe "tr/()/ \n/" YourFile > NewFile
If you are running this on a unix box, switch the double quotes to single
quotes.
Perl will know what the 'right' newline is for your OS. Then the resulting
file
should be imminently readable by SAS, and you won't have the 'long line'
problem
to fight with.
Of course, if you are having this trouble because you are on Windows and you
are
trying to read a unix file, then you may *see* the file as being all one
long line,
when in fact it actually has line breaks, probbly in between the close and
open
parens. If so, then you could fix this by the easy solution of including
the following
option in your INFILE statement and not knocking yourself out with all the
other
stuff:
TERMSTR=LF
If this doesn't work, then you'll have to go with Howard's solution, or
Paul's. Or
even mine...
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/