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?
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);
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 ...
libname new "/dmenv/dmwork/gsk2118436/brf113928/test/raw/FROM_FSP/Transfer_20190916/BRF113928_ToNovartis_20190916/new";
libname old "/dmenv/dmwork/gsk2118436/brf113928/test/raw/FROM_FSP/Transfer_20190910/BRF113928_ToNovartis_20190910/old";
proc sql;
select distinct memname into:macvar separated by ' '
from sashelp.vstable
where upcase(libname)="NEW" ;
quit;
%put &macvar;
%macro test;
%local i;
%do i= 1 %to &sqlobs;
%let dst=%scan(&macvar,&i,' ');
Proc Compare Base = new.&dst Compare = old.&dst/*Outbase OutComp Outdiff Outnoequal*/listall
Out = Dm_Diff_comp ;
Run;
%end;
%mend;
%put &dst ;
%test;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.