Date: Fri, 30 Sep 2011 16:01:52 -0400
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject: Re: Data step stops processing if no observations read from where
Not sure what you want to do, but you can test EOF before the SET statement
and that will prevent SAS from stopping before it gets to your output
statement.
data master_append;
put "BEFORE: " _ALL_;
if eof then do i = 1 to 5;
output;
end;
set master end=eof;
where x = 2;
output;
put "AFTER: " _ALL_;
run;
On Fri, 30 Sep 2011 12:49:45 -0700, Sterling Paramore <gnilrets@GMAIL.COM>
wrote:
>There is no x=2 in the master dataset, but I still want it to append
>data to the bottom of the dataset (and I want it to append data to the
>bottom of the dataset in the case that there was x=2). Any ideas?
>
>Thanks,
>Sterling
>
>20 data master_append;
>21
>22 put "BEFORE: " _ALL_;
>23 set master;
>24 where x = 2;
>25 put "AFTER: " _ALL_;
>26
>27 do i = 1 to 5;
>28 output;
>29 end;
>30 run;
>
>BEFORE: x=. i=. _ERROR_=0 _N_=1
>NOTE: There were 0 observations read from the data set WORK.MASTER.
> WHERE x=2;
>NOTE: The data set WORK.MASTER_APPEND has 0 observations and 2 variables.
>NOTE: DATA statement used (Total process time):
> real time 0.00 seconds
> cpu time 0.01 seconds
|