Thanks Ian,
FYI for anyone who clipped Howard's code, and is in V8.
"Howard's solution works in 6.12, but V8 has tightened up the code so that
one should not use an existing fileref with the FILEVAR option. See
SN-001168
Do not use existing fileref with FILEVAR= on INFILE "
Sent: Tuesday, September 05, 2000 3:33 PM
To: 'Kerrison, James'
Subject: RE: Creating a file IF....
James,
FILE is both executable and compile time directive. As a compile time
directive a buffer is set up and the old file wiped out (unconditionaly when
the code is read). As an executable the buffer pointer is changed when the
IF statement is true. However, for an empty dataset, execution stops
on the SET statement. Howard's solution works in 6.12, but V8 has tightened
up the code so that
one should not use an existing fileref with the FILEVAR option. See
SN-001168
Do not use existing fileref with FILEVAR= on INFILE
-----Original Message-----
Sent: Monday, August 28, 2000 11:31 AM
Subject: Creating a file IF....
This seems like a simple enough step, but I can't get it right. I am trying
to create a file IF there is data in a dataset.
My code looks something like this:
data _null_ ;
set dataset;
if _n_ = 1 then do ;
file "filexxx.txt";
end ;
run ;
I am assuming that if the dataset is null that the if statement will
evaluate to 0, and nothing will happen. However the file is still being
created even though there is no data in the dataset being set! Any ideas or
pointers would be appreciated.
TIA,
Foster Kerrison