If you work in the field of clinical reporting then you sometimes have
studies that run for many years. You then report them in "increments",
maybe every two years. During the course of the trial then it is not possible
to prevent old data being changed, but if it has been changed then it should
be for a good reason. There could be many datasets to check for changes
and each will have to be sorted in a different way before they can be compared
using "proc compare". Fortunately, I have a macro called %complibs
to do this work which can save you a lot of time.
Using %complibs
%complibs compares whole libraries for identically named datasets.
You specify the sort variables that will be used sort into unique order.
The macro calls the macro %supasort
to sort these datasets by those variable but only if they exist in the
sas dataset. This list of variables will include a unique patient identifier
plus visit code plus any subparameters such as labparm and maybe
a sequencing variable and date. The easiest way to get a list of these
is to run the compare and where you see a lot of differences found in a
dataset then chances are you need to add an extra variable to the sort
list. You can look at the contents of the dataset and see which extra variable
you need to sort uniquely. Here is an example call to %complibs where only
the old data is compared (using the listbase option -- see documentation
for "proc compare").
libname old "old-data-library-full-path-name" access=readonly;
libname new "new-data-library-full-path-name" access=readonly;
%complibs(old,new,options=listbase, sortvars=patid visitcd date seqn labid labparm protdevn);
Conclusion
This page describes how you can compare whole libraries to find out what
data have changed.