Desktop productivity for business analysts and programmers

proc compare multiple data sets in one go

Reply
Frequent Contributor
Posts: 82

proc compare multiple data sets in one go

If I have 10 sas datasets in folder A and 10 sas datasets in folder B, can I compare the two folders, matching the datasets by their name, or do i need to write 10 different proc compare statements, one for each data set?

Esteemed Advisor
Esteemed Advisor
Posts: 7,262

Re: proc compare multiple data sets in one go

Have a look at the macro documentation.   Also you could use a datastep and call execute.  There are many examples on here on either style.

%macro do_compare(file=);

     proc compare base=&file. comp=file out=&comp_file.;

     run;

%mend do_compare;

%do_compare(file=filea);

%do_compare(file=fileb);

Grand Advisor
Posts: 10,253

Re: proc compare multiple data sets in one go

If there is something specific you are trying to determine it might be time to ask for help with the specific desired comparisons. Since Proc Compare kind of expects sets to be sorted in the same order to get many of the more interesting results ...

Ask a Question
Discussion stats
  • 2 replies
  • 685 views
  • 0 likes
  • 3 in conversation