diff --git a/sas/sasjs/services/approvers/gethistory.sas b/sas/sasjs/services/approvers/gethistory.sas index e694ef1..65c79e7 100644 --- a/sas/sasjs/services/approvers/gethistory.sas +++ b/sas/sasjs/services/approvers/gethistory.sas @@ -105,8 +105,6 @@ create view work.submits as ,a.submitted_by_nm as submitter ,put(a.REVIEWED_ON_DTTM,yymmddhhmmss.) as REVIEWED ,a.submit_status_cd as status - ,a.reviewed_on_dttm - ,a.reviewed_by_nm as approver from &mpelib..mpe_submit(where=(submit_status_cd ne 'SUBMITTED')) a %macro gethistory(); @@ -120,8 +118,18 @@ create view work.submits as %end; %mend gethistory; %gethistory() +; - order by a.submitted_on_dttm desc; +/* get latest reason text */ +create table work.reviews as + select a.* + ,b.reviewed_on_dttm + ,b.reviewed_by_nm as approver + ,b.review_reason_txt + from work.submits a + left join &mpelib..mpe_review b + on a.table_id=b.table_id + order by a.table_id desc, b.reviewed_on_dttm desc; %mp_abort(iftrue= (&syscc > 0) ,mac=&_program @@ -129,7 +137,9 @@ create view work.submits as ) data work.fromsas; - set work.submits; + set work.reviews; + by descending table_id descending reviewed_on_dttm; + if first.table_id; if _n_ ge &startrow; n+1; if n>&hist then stop;