From 00abbdcd659e111ed655719f332327d6c52eea44 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Tue, 10 May 2022 20:58:35 +0000 Subject: [PATCH] fix: switching to proc datasets for ddl indexes --- ddl/mddl_dc_difftable.sas | 16 +++++++++++++--- ddl/mddl_dc_filterdetail.sas | 16 +++++++++++++--- ddl/mddl_dc_filtersummary.sas | 14 +++++++++++--- ddl/mddl_dc_locktable.sas | 15 +++++++++++++-- ddl/mddl_dc_maxkeytable.sas | 15 ++++++++++++--- 5 files changed, 62 insertions(+), 14 deletions(-) diff --git a/ddl/mddl_dc_difftable.sas b/ddl/mddl_dc_difftable.sas index 78265e0..e77fb72 100644 --- a/ddl/mddl_dc_difftable.sas +++ b/ddl/mddl_dc_difftable.sas @@ -26,9 +26,19 @@ oldval_num num format=best32. label='Old (numeric) value', newval_num num format=best32. label='New (numeric) value', oldval_char char(32765) label='Old (character) value', - newval_char char(32765) label='New (character) value', - constraint pk_mpe_audit - primary key(load_ref,libref,dsn,key_hash,tgtvar_nm) + newval_char char(32765) label='New (character) value' ); + %local lib; + %let libds=%upcase(&libds); + %if %index(&libds,.)=0 %then %let lib=WORK; + %else %let lib=%scan(&libds,1,.); + + proc datasets lib=&lib noprint; + modify %scan(&libds,-1,.); + index create + pk_mpe_audit=(load_ref libref dsn key_hash tgtvar_nm) + /nomiss unique; + quit; + %mend mddl_dc_difftable; \ No newline at end of file diff --git a/ddl/mddl_dc_filterdetail.sas b/ddl/mddl_dc_filterdetail.sas index a49ac9d..fa5e4a2 100644 --- a/ddl/mddl_dc_filterdetail.sas +++ b/ddl/mddl_dc_filterdetail.sas @@ -19,9 +19,19 @@ variable_nm varchar(32) not null, operator_nm varchar(12) not null, raw_value varchar(4000) not null, - processed_dttm num not null format=E8601DT26.6, - constraint pk_mpe_filteranytable - primary key(filter_hash,filter_line) + processed_dttm num not null format=E8601DT26.6 ); + %local lib; + %let libds=%upcase(&libds); + %if %index(&libds,.)=0 %then %let lib=WORK; + %else %let lib=%scan(&libds,1,.); + + proc datasets lib=&lib noprint; + modify %scan(&libds,-1,.); + index create + pk_mpe_filterdetail=(filter_hash filter_line) + /nomiss unique; + quit; + %mend mddl_dc_filterdetail; \ No newline at end of file diff --git a/ddl/mddl_dc_filtersummary.sas b/ddl/mddl_dc_filtersummary.sas index 55b04fb..2e75c67 100644 --- a/ddl/mddl_dc_filtersummary.sas +++ b/ddl/mddl_dc_filtersummary.sas @@ -14,9 +14,17 @@ filter_rk num not null, filter_hash char(32) not null, filter_table char(41) not null, - processed_dttm num not null format=E8601DT26.6, - constraint pk_mpe_filteranytable - primary key(filter_rk) + processed_dttm num not null format=E8601DT26.6 ); + %local lib; + %let libds=%upcase(&libds); + %if %index(&libds,.)=0 %then %let lib=WORK; + %else %let lib=%scan(&libds,1,.); + + proc datasets lib=&lib noprint; + modify %scan(&libds,-1,.); + index create= filter_rk /nomiss unique; + quit; + %mend mddl_dc_filtersummary; \ No newline at end of file diff --git a/ddl/mddl_dc_locktable.sas b/ddl/mddl_dc_locktable.sas index bd3ecd7..ca09140 100644 --- a/ddl/mddl_dc_locktable.sas +++ b/ddl/mddl_dc_locktable.sas @@ -18,8 +18,19 @@ lock_ref char(200), lock_pid char(10), lock_start_dttm num format=E8601DT26.6, - lock_end_dttm num format=E8601DT26.6, - constraint pk_mp_lockanytable primary key(lock_lib,lock_ds) + lock_end_dttm num format=E8601DT26.6 ); + %local lib; + %let libds=%upcase(&libds); + %if %index(&libds,.)=0 %then %let lib=WORK; + %else %let lib=%scan(&libds,1,.); + + proc datasets lib=&lib noprint; + modify %scan(&libds,-1,.); + index create + pk_mp_lockanytable=(lock_lib lock_ds) + /nomiss unique; + quit; + %mend mddl_dc_locktable; \ No newline at end of file diff --git a/ddl/mddl_dc_maxkeytable.sas b/ddl/mddl_dc_maxkeytable.sas index 163b8ff..583b691 100644 --- a/ddl/mddl_dc_maxkeytable.sas +++ b/ddl/mddl_dc_maxkeytable.sas @@ -17,8 +17,17 @@ max_key num label= 'Integer representing current max RK or SK value in the KEYTABLE', processed_dttm num format=E8601DT26.6 - label='Datetime this value was last updated', - constraint pk_mpe_maxkeyvalues - primary key(keytable)); + label='Datetime this value was last updated' + ); + + %local lib; + %let libds=%upcase(&libds); + %if %index(&libds,.)=0 %then %let lib=WORK; + %else %let lib=%scan(&libds,1,.); + + proc datasets lib=&lib noprint; + modify %scan(&libds,-1,.); + index create keytable /nomiss unique; + quit; %mend mddl_dc_maxkeytable; \ No newline at end of file