Date: Sun, 14 Oct 2007 11:51:08 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: no data created??? file out filevar=
On Fri, 12 Oct 2007 11:48:05 -0700, adac1121@GMAIL.COM wrote:
>DATA tmp;
>LENGTH LINE $ 108 FILELOC $ 128
> NEWDATE $ 8;
> FORMAT LINE $108. INLINE $VARYING128.;
> INPUT FILELOC $;
> INFILE dat filevar=FILELOC MISSOVER LENGTH=LINELEN
>
>COLUMN=COL end=done;
>
>DO WHILE (NOT DONE);
>
>food='/xxxx/0124001.01';
>
>FILE OUT filevar=food MOD;
> PUT LINE $108.;
>
>end;
>
>DATALINES;
>/food1xxx.DAT
>/food2vvvv.DAT
>
>I have no data for the output????
>
>I can't find any reference for dat and out after the infile and file
>statement??? can we use any name before filevar=???
>
>Thanks,
Here's a simplified model of what I think is wanted.
First, generate some test input:
data _null_;
file 'food1xxx.DAT';
put 'a' /'b';
file 'food2vvvv.DAT';
put 'c' /'d';
run;
The task I believe is to concatenate a series of specified files into one
all-inclusive file. Here's the code:
DATA _null_;
infile datalines;
INPUT FILELOC $;
INFILE dat filevar=FILELOC end=done;
FILE 'xxxx-0124001.01';
DO WHILE (NOT DONE);
input;
PUT _infile_;
end;
DATALINES;
one
two
;
Notice the additional INFILE statement, so that SAS always knows where it is
expected to read next.
Notice the additional INPUT statement inside the DO loop.
Notice that there is no need for FILEVAR= on the output side.
Check the output:
data _null_;
infile 'xxxx-0124001.01';
input;
put '>>> ' _infile_;
run;
Log shows:
>>> a
>>> b
>>> c
>>> d
One thing that I don't quite understand: How come it is not necessary to
reinitialize DONE to 0 somewhere outside the DO loop?