Date: Tue, 12 Mar 2002 12:44:36 -0500
Reply-To: kviel <kviel@GMCF.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: kviel <kviel@GMCF.ORG>
Subject: Re: Maximum input line size?
Content-Type: text/plain; charset="iso-8859-1"
>2. The second problem I bumped into was to be expected. The data lines
> were so long that the system could not process them. So I used the
> SCANOVER option to split the data into separate lines. However, the
> end result still does not work - after the input the data matrix
> does not contain any data. Below I have attached the commands,
> listing (generated by PROC PRINT) and the log file for a toy
> example with just four variables / observations (the last variable
> is just a label for MDS).
>
>What might be the problem here?
>
>---------------- Commands -------------------------------------
>options ls=64 nodate;
>data filter;
>infile cards scanover;
>input @'split' (F1 F2
>F3 F4
>) (6.3) filter $3.;
>cards;
>1.000 0.019
>0.000 0.001
>F1 split
^
HERE
^^^^
Jarmo,
I have not used the SCANOVER option, but I have used the TRUNCOVER and
MISSOVER options. I do not believe this suits your needs:
156 data filter;
157 infile cards scanover;
158 input @'split' (F1 F2
159 F3 F4) (6.3) filter $3.;
160 put f1= f2= f3= f4=;
161 cards;
F1=. F2=. F3=. F4=.
NOTE: SAS went to a new line when INPUT @'CHARACTER_STRING' scanned past the
end of a line.
NOTE: The data set WORK.FILTER has 1 observations and 5 variables.
NOTE: DATA statement used:
real time 0.09 seconds
cpu time 0.03 seconds
165 ;
166 run;
I believe this occurs because the SCANOVER options scans the input until SAS
finds the string indicated, in this case "split", and then it begins to
input F1 (see HERE above). You are trying to create an observation over
several records (lines of data). There is a line-pointer control that may
be what you desire:
data filter;
infile cards;
input #1 F1 F2
#2 F3 F4
#3 filter $3.;
put f1= f2= f3= f4=;
cards;
1.000 0.019
0.000 0.001
F1 split
;
run;
In this case I have dropped the format since the default format can handle
it. If you should like, you can format the output for viewing. You could
also put a 6.3 after every variable in the INPUT statement.
I have written a macro which will automate the above, however, I am not sure
what might happen with the line size:
options mprint;
%macro lst(n=, /* number of lines */
m=, /* number of variables per line */
var= /* variable prefix */);
%do i=1 %to &n; /* line */
#&i
%do j=1 %to &m; /* variables */
&var.%eval(%eval(%eval(&i-1)*&m)+&j) 6.3
%end;
%end;
%mend lst;
data filter;
infile cards;
input %lst(n=2, m=2, var=F)
#3 filter $3.;
put f1= 6.3 f2= f3= 6.3 f4=;
cards;
1.000 0.019
0.000 0.001
F1 split
;
run;
Be sure to note the that macro call is *not* a SAS statement; follow it with
a semi-colon and it will bomb.
I would like to know more about the size of the input statement and the
implications for the macro, if this satisfies your requirements.
Regards,
Kevin
Kevin Viel
Georgia Medical Care Foundation
57 Executive Park South, NE
suite 200
Atlanta, GA 30329-2224