how to get deleted information which observation is deleted and which variable is deleted in a library
proc sql;
delete from work.sashelp.class
where name='Alfred'
;
quit;
By selecting the obs with a separate select-statement before the delete-statement.
Or you do
data
kept
deleted
;
set have;
if <condition>
then output kept;
else output deleted;
run;
Ah OK, @Kurt_Bremser ,
I thought the questioner was after finding out how many and which observations were logically deleted (and NOT physically deleted).
But I guess you're program is offering what (s)he is looking for.
Cheers,
Koen
Since (s)he provided garbage as example (untested code that can never run), and not a "have" vs. "want" dataset, it's hard to get what the question is about.
The deleted observations in a dataset can be found in DICTIONARY.TABLES.
To find out if a variable is not present in a dataset, you have to compare it with another dataset. The data for both can be found in DICTIONARY.COLUMNS.
@Kurt_Bremser wrote:
The deleted number of observations in a dataset can be found in DICTIONARY.TABLES.
To find out if a variable is not present in a dataset, you have to compare it with another dataset. The data for both can be found in DICTIONARY.COLUMNS.
I believe my correction above is what was intended.
@BrahmanandaRao wrote:
I want deleted information in a library
Which obs and which var deleted for each dataset
Will only be possible if you have a "before" and "after" data set or if using data set generations(essentially a before and after for the same named data set)
Proc Compare might be the tool but you will have to tell the procedure which data sets to compare. The data sets should be in the same sort order as well.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.