09-05-2012 06:02 AM
Please Go through this link..It may be use full to you...
09-05-2012 06:08 AM
The ENDSAS statement immediately terminates the SAS job or session. An interactive program that writes output to the OUTPUT window should not use this statement because the contents of the OUTPUT window (as well as the LOG & Program Editor windows) will be lost. However when output is directed to files (as in a batch program or when using PROC PRINTTO) or when just data sets are being created, the ENDSAS statement can be used to control job or session termination.
The entire job is terminated in the following data step if the
variable X is ever less than or equal to zero.
if _error_ then endsas;
The ENDSAS statement can also be used between steps when execution of only a portion of a program is desired.
…some SAS statements…
…unexecuted SAS statements…