Hello,
I need to compare more thant 1 000 datasets using the proc compare procedure. To do that, I am using a call execute and it works well.
However, the results are print on a html page of SAS EG. How to route this HTML page to a precise location and name? Example /.../sasdata/Data_Retention/Validation/output/comparison.html.
libname source base '/.../sasdata/Data_Retention/Validation/datasets';
Data workingdatasetdr (keep=path fname);
set source.workingdatasetdr;
run;
Data workingdataset (keep=path fname);
set source.workingdataset;
run;
proc sort data=workingdataset nodupkey out=workingdataset_ndk;
by path fname;
run;
proc sort data=workingdatasetdr nodupkey out=workingdatasetdr_ndk;
by path fname;
run;
proc compare base=workingdataset_ndk compare=workingdatasetdr_ndk;
var fname;
run;
/*********************************************/
data workingdataset_ndk (rename=(path=path1 fname=fname1));
set workingdataset_ndk;
run;
data workingdatasetdr_ndk (rename=(path=path2 fname=fname2));
set workingdatasetdr_ndk;
run;
%macro doit(path1,path2,fname1,fname2);
libname source1 spde "&path1.";
libname source2 spde "&path2.";
proc compare base=source1.&fname1. compare=source2.&fname2.;
run;
libname source1 clear;
libname source2 clear;
%mend doit;
proc sql;
create table workingdataset as
select a.*,
b.*
from workingdataset_ndk as a
inner join workingdatasetdr_ndk as b
on(a.fname1=b.fname2);
quit;
data workingdataset;
set workingdataset (firstobs=1 obs=5);
run;
data _null_;
set workingdataset;
call execute(cats('%nrstr(%doit)(path1=',path1,',path2=',path2,',fname1=',fname1,',fname2=',fname2,');'));
run;
A single html page or a separate one for each comparison?
The statement is going to be something like
ODS HTML path="/.../sasdata/Data_Retention/Validation/output/"
body ="comparison.html"
;
<all the code generating output goes here>
ods html close;
You can use an ODS statement to setup an HTML destination to that file. Include an ID for the new HTML destination to distinguish it from any other HTML destinations that EG might have created already.
ods html(compare) path="/.../sasdata/Data_Retention/Validation/output" file="comparison.html";
... rest of code that makes output here ...
ods html(compare) close;
You will probably want to turn off sending the results to the default HTML destination that EG creates for you, unless you want two copies.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.