from my understanding the data step is like a loop. I have the code below and dbtblnames_complete has 2 entries I am getting a different dbms error for each. However the %put statement at the end of the macro(for &sqlxrc &SQLXMSG) only shows the second error 2 times. What is going on? Where am I misunderstanding? %macro tstuniqvalid(crnttblname);
proc sql;
connect to teradata as eiwp (username=&xxxuser. password=&xxxpass. tdpid=&xxxx_TDPID. mode=teradata fastload=yes);
create table unique_validcustid as
select count(*) from connection to xxxx (
select hist_ky_add
,count(*)
from (select cast(cust_id as decimal(15,0)) as cust_id_test
,cust_id
,cust_id_type
,cell_ky
,rank(cust_id || cust_id_type || cast(cell_ky as varchar(16))asc)as hist_ky_add
from &crnttblname) a
group by 1
having count(*) > 1
);
%put "SQL Return code and message" &sqlxrc &SQLXMSG;
quit;
%mend;
data _null_/debug;
set dbtblnames_complete;
call execute('%tstuniqvalid(' || strip(newtblname1) || ');');
run; so
... View more