General form, SET statement
with KEY= option:
SET SAS-data-set-name KEY= index-name;
index-name
is the name of an index
that is associated with the SAS-data-set-name data
set.
|
set sasuser.sale2000 key=flightdate;
data work.profit; set sasuser.dnunder; set sasuser.sale2000(keep=routeid flightid date rev1st revbusiness revecon revcargo) key=flightdate; Profit=sum(rev1st, revbusiness, revecon, revcargo, -expenses); run;
1
, which indicates unmatched
data. The _N_ variable indicates
the iteration of the DATA step in which the error occurred.
FlightID=IA11802 RouteID=0000108 Date=30DEC2000 Expenses=3720
Rev1st=1270 RevBusiness=. RevEcon=5292 RevCargo=1940 Profit=4782
_ERROR_=1 _IORC_=1230015 _N_=57
NOTE: There were 57 observations read from the data set
SASUSER.DNUNDER.
NOTE: The data set WORK.PROFIT has 57 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.38 seconds
cpu time 0.04 seconds |
0
if
there is no match
data work.profit3 work.errors; set sasuser.dnunder; set sasuser.sale2000(keep=routeid flightid date rev1st revbusiness revecon revcargo)key=flightdate; if _iorc_=0 then do; Profit=sum(rev1st, revbusiness, revecon, revcargo, -expenses); output work.profit3; end; else do; _error_=0; output work.errors; end; run;