Date: Thu, 7 Aug 2003 20:24:09 -0400
Reply-To: Jonathan Siegel <jmsiegel@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jonathan Siegel <jmsiegel@YAHOO.COM>
Subject: Re: infile stopover option
On Fri, 1 Aug 2003 13:23:13 -0700, Tom S <thomas.sarosky@ADVANCEPCS.COM>
wrote:
I am wondering if you are trying to use these functions for a differen
purpose from what they are intended to do.
These functions affect what SAS should do if it reads in data and encounters
an end-of-line while it's in the middle of what (according to the program)
is supposed to be the next line. Does it set all following variables to
missing? Does it stop? There are various options to set what it does.
However, because you added the lrecl=2000 option, you padded the line so
that reading the first 1566 characters never gets to the end. The various
'OVER' options will never come into play.
It sounds like what you really want to do is to get SAS to do something when
it encounters a missing value (columns that contain no data). This is a
different problem. Columns with no data aren't a problem to SAS and SAS will
happily read them, assign them missing values, and keep going.
What you'll need to do is to create your own logic to deal with the problem.
For example, if you want the data step to stop, you could do something like
this:
data RIa;
infile in1 dsd lrecl=2000;
input VAR1..... VAR29 $1563 VAR30 1564-1566;
if VAR30 = . then do;
put "WAR" "NING: Missing value of VAR30 found " _n_=;
stop;
end;
run;
Jonathan Siegel
>I'm reading raw data from a client's text file arranged in columns. I
>am using the STOPOVER option on the infile statement.
>
>data RIa;
> infile in1 stopover dsd lrecl=2000;
> input VAR1..... VAR29 $1563 VAR30 1564-1566;
>run;
>
>
>The raw data file has some missing values for VAR30 in columns
>1564-1566. Now, according to STOPOVER option, I should get an error
>if these columns contain no data. However, I do not get an error and
>all data is read in just fine. My question is WHY? Is there some
>type of end-of-record character which I can't see that SAS is using?
>When I try to create my own test file with missing data in the last
>colum, I get an error as expected with the STOPOVER option.
>
>I know I should be using the MISSOVER or TRUNCOVER, but this has me
>baffled why it works using STOPOVER.