Date: Tue, 11 Mar 2008 09:19:11 -0700
Reply-To: Duh_OZ <ozzy.kopec@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Duh_OZ <ozzy.kopec@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Noobie here - EOF (hex 1A) Q. (long post)
Content-Type: text/plain; charset=ISO-8859-1
On Mar 11, 11:01 am, rdevene...@WILDBLUE.NET ("Richard A. DeVenezia")
wrote:
> Duh_OZ wrote:
> > Had the programming I & II courses, but their data and real world data
> > is two different things :0)
>
> > I wrote a simplistic program to read in multiple files and output a
> > FREQ. The gist is a file may have a hex 1A (EOF) appended onto it
> > (if the file had been edited). Simplistic ASCII flat file - each
> > line has a hex 0D0A (CR/LF) which presents no problem. The problem
> > is the hex 1A which is read in and SAS tries to process the record.
>
> Hex 1A is Chr(26), or Control-Z, aka ^Z, which in the ancient DOS world is
> the end-of-file marker for text files.
>
> Use the INFILE option IGNOREDOSEOF to read past this ancient marker.
>
> In this sample code you will see how the second infile reads all the
> records. However, you will need some extra logic to remove the input NOTEs
> and missing values -- as shown in the third reading step.
> ----------
> filename foo temp;
>
> data _null_;
> file foo;
> do i = 1 to 10;
> put i;
> if mod(i,3)=0 then put '1A'X;
> end;
> run;
>
> data check;
> infile foo ;
> input x;
> run;
>
> data check;
> infile foo IGNOREDOSEOF ;
> input x;
> run;
>
> data check;
> infile foo IGNOREDOSEOF ;
> input x;
> if x=. and _error_=1 then
> _error_=0;
> else
> output;
> run;
> ----------
>
> Richard A. DeVeneziahttp://www.devenezia.com
=============
Alas, trying that option results in this:
=======
16 data check;
17 infile foo IGNOREDOSEOF ;
____________
23
ERROR 23-2: Invalid option name IGNOREDOSEOF.
=========
Thanks for the try though!
|