Search code examples
sas

Retrieving deleted observations in SAS


We were discussing the nobs= option of SAS today (gotcha below), and the question came up - how do you restore / retrieve deleted observations?

data test;
x=1;
output;
x=2;
output;
run;

proc sql;
    delete from test where x=2;
quit;

data _null_;
    set test nobs=n;
    put n=; /* gotcha */
run;

Solution

  • Despite the records being "marked for deletion", thus suggesting that there might be a way to "unmark for deletion", there is currently no facility to recover these records. It's too bad as it seems like it might be useful in some cases.