In the following
program, Route1.dat, Route2.dat, Route3.dat, Route4.dat, and Route5.dat
are also concatenated to create the SAS data set Work.NewRoute. In
this example, the names of the raw data files are stored in the external
file Rawdatafiles.dat, which is referenced in the first INFILE statement.
The name of the FILEVAR= variable, Readit, is the name of the variable
read from Rawdatafiles.dat. The value of Readit is the name of the
raw data file to be read.
Table 14.15 Raw Data File Rawdatafiles.dat
1---+----10---+----20
route1.dat
route2.dat
route3.dat
route4.dat
route5.dat
|
data work.newroute;
infile 'rawdatafiles.dat';
input readit $10.;
infile in filevar=readit end=lastfile;
do while(lastfile = 0);
input @1 RouteID $7. @8 Origin $3. @11 Dest $3.
@14 Distance 5. @19 Fare1st 4.
@23 FareBusiness 4. @27 FareEcon 4.
@31 FareCargo 5.;
output;
end;
run;