PING  0.9
Statistical data handling and processing in production environment
obs_duplicate

Extract duplicated/unique observations from a given dataset.

%obs_duplicate(idsn, dim=, dupdsn=, unidsn=, select=, ilib=WORK, olib=WORK);

Arguments

  • idsn : a dataset reference;
  • dim : (option) list of fields/variables of idsn ;
  • select : (option) expression used to refine the selection (WHERE option); should be passed with %str; default: empty;
  • ilib : (option) name of the input library; by default: empty, i.e. WORK is used;
  • olib : (option) name of the output library; by default: empty, i.e. WORK is also used.

Returns

  • dupdsn : name of the output dataset with duplicated observations; it will contain the selection operated on the original dataset;
  • unidsn : name of the output dataset with unique observations.

Examples

  • ### References
  1. Note on "FIRST. and LAST. variables".
  2. Note on "Working with grouped observations".
  3. "How the DATA step identifies BY groups".
  4. Cai, E. (2015): "Getting all Duplicates of a SAS data set".
  5. Cai, E. (2015): "Separating unique and duplicate observations using PROC SORT in SAS 9.3 and newer versions".

See also

%obs_select, %ds_isempty, %ds_check, %sql_clause_by, %sql_clause_as, %ds_select, SELECT.