Date: Fri, 18 Mar 2011 13:08:45 -0400
Reply-To: Philip C <SASL.PhilipC@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Philip C <SASL.PhilipC@GMAIL.COM>
Subject: set and file
Content-Type: text/plain; charset=ISO-8859-1
I need some guidance please. I'm puzzled by the interaction between the
set statement and the file statement in the code below. This code works
well if DATASET has 1 or more records. It doesn’t work well if the
DATASET has zero records. If there are zero records, then NO records are
output to XLFILE. My desire is to have at least the last PUT statement to
be outputted to XLFILE, in the case that there are no records in DATASET.
This code is my latest unsuccessful attempt to do this.
data _null_;
file XLFILE;
do until (eof);
set DATASET
(WHERE=(TYPE=10))
end=eof nobs = nobs ;
if nobs then do;
put dornum "09"x fullname "09"x office "09"x
"09"x "09"x"09"x "09"x &COMMENT;
end;
end;
put "09"x "09"x "09"x "09"x "09"x "09"x "09"x "&OBIS_Data_Comment";
stop;
run;
|