Hi DevNand, I did not really try to understand your code, But this is an (untested) way to loop over some procs. HTH Jeroen. BTW I have some troubles formatting these messages . So sorry for that. proc sql; create table driver as select Query_ID , DB2_Query , TD_QUery from test123 ; quit; %macro do_it(Query_ID, DB2_Query, TD_QUery); proc sql NOERRORSTOP EXEC; connect to db2 as db2 (connection parameter) create table work.db2_&Query_ID as select * from connection to db2 (&DB2_Query ) ; connect to teradata as td (connection parameter); execute(<There seems to be missing a teradata query id here>) by td; create table work.td_&Query_ID as select * from connection to td (&TD_QUery) ; quit; PROC SORT DATA=chase.db2_&Query_ID OUT=chase.db2_sort_&Query_ID; BY _all_; RUN; PROC SORT DATA=work.td_&Query_ID OUT=work.td_sort_&Query_ID; BY _all_; RUN; ods listing; proc compare base=work.db2_sort_&Query_ID compare=work.chase.td_sort_&Query_ID; run; /* Delete your files here */ ods tagsets.excelxp close; ods listing close; %mend; data _null_; set driver; call execute ('%do_it (' !! Query_ID !! ',' !! DB2_Query !! ',' TD_QUery !! ');'); run;
... View more