Hi, I have this code from a SAS-supplied solution macro: proc sql;
update seg_kc.fsc_entity_watch_list_dim
set change_end_date=dhms(input(put(&runasofdate,8.),yymmdd8.),00,00,00),
change_current_ind = 'N'
where upcase(watch_list_name) = 'WCHK' and
upcase(change_current_ind) = 'Y' and
entity_watch_list_number in
(select entity_watch_list_number
from STG_WTCH.wl_wchk_delete_load);
quit; I've modified it to close out all records, not just those matching the sub-query: proc sql;
update seg_kc.fsc_entity_watch_list_dim
set change_end_date=dhms(input(put(&runasofdate,8.),yymmdd8.),00,00,00),
change_current_ind = 'N'
where upcase(watch_list_name) = 'WCHK' and
upcase(change_current_ind) = 'Y';
quit; However, it is taking forever to run. I've always been taught not to call a function for every record in the dataset/table if that function is in fact just returning a constant. I was also hoping the below would make PROC SQL use implicit pass-through to Oracle: %* get runasofdate ;
%fcf_get_runasofdate;
%put;
%put >>> RUNASOFDATE: &runasofdate;
%put;
%* convert to datetime - this will execute once, at compile time ;
%let datetime=%sysfunc(putn(%sysfunc(inputn(&runasofdate,yymmdd8.)),date9.)):00:00:00;
%put >>> DATETIME: &datetime;
proc sql noprint;
update seg_kc.fsc_entity_watch_list_dim
set
change_end_date = "&datetime"dt,
change_current_ind = 'N'
where
upcase(watch_list_name) in ('WCHK','WORLDCHECK')
and
upcase(change_current_ind) = 'Y'
;
quit; But this is still taking forever. I can convert this to explicit pass-through, which performs well, but there may be issues with that when crossing environments (DEV/TEST/PROD) - I'd have to investigate that further. So, is there a way convert the above code to implicit pass-through, or otherwise improve the query performance? Thanks...
... View more