deleting specifiek records in an index dataset
Several methods can be used when deleting specifiek records from an
index datasets.
I compare proc sql and data step modify. Records to be deleted are in
james_existing_ctt dataset.
Datastep is much faster.
proc sql;
delete * from cma.cma_src_james
where id_cttmmt in (select id_Cttmmt from james_existing_ctt)
;
quit;
NOTE: 7577 rows were deleted from CMA.CMA_SRC_JAMES.
10764 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 12:10.22
cpu time 7:49.40
data cma.CMA_SRC_JAMES;
set james_existing_ctt;
modify cma.CMA_SRC_JAMES key=ID_CTTMMT;
select (_IORC_);
when (%SYSRC(_SOK)) do;
remove;
_iorc_=0;
end;
when (%SYSRC(_DSENOM)) do;
* output;
_error_=0;
end;
otherwise do;
put 'ERR' 'OR: Unknown IO ';
stop;
end;
end;
run;
NOTE: Data set options for master data set should be specified in
MODIFY statement.
NOTE: There were 7577 observations read from the data set
WORK.JAMES_EXISTING_CTT.
NOTE: The data set CMA.CMA_SRC_JAMES has been updated. There were 0
observations rewritten, 0
observations added and 7577 observations deleted.
NOTE: DATA statement used (Total process time):
real time 29.61 seconds
cpu time 10.23 seconds