Hi !
The code below helps me to pick the last timestamp record whereas i want the latest one.
Example :
An account A1 have 2 email ids E1 with Timestamp 12/20/2020 12 :30:00 and E2 with Timestamp 09/02/2020 12 :10:00 then it should pick the E1 record but in my code it will pick E2 as it is the last one.
Please highlight the changes I need to do in below code.
*****************************************************************************************************************
libname rpl "/stage_1/download/backup/adhoc/kyccrs/083020/bestbuy_dcfaccess_weekly";
options obs = max yearcutoff=1940;
%macro a;
(KEEP = WS_ACCT_NUM WS_EMAIL_ADDR_LAST WS_EMAIL_ADDR)
%mend;
data rpl_dcf;
set rpl.bbrdcf_eaddr083020;
set rpl.bbrdcf_eaddrpii083020;
run;
Proc sort data =rpl_dcf;
by WS_ACCT_NUM WS_EMAIL_ADDR_LAST ;
run;
/* using last account that is sorted by account & timestamp. */
data all;
set rpl_dcf;
by WS_ACCT_NUM;
if last.WS_ACCT_NUM ;
run;
Proc sort data =all;
by WS_ACCT_NUM WS_EMAIL_ADDR_LAST ;
run;
data all;
RETAIN WS_ACCT_NUM WS_EMAIL_ADDR_LAST WS_EMAIL_ADDR ;
set all %a;
run;
proc export data = all
outfile="/etl/home/rrtqarun/data/aml/Datasets/cardholder/dataset_frequency/trial083020.csv"
dbms=csv
replace;
delimiter= '|';
run;
*****************************************************************************************************************
help will be appreciated