From 9a047ad42ec86df7d1eaf5058c0edde56016e88f Mon Sep 17 00:00:00 2001 From: dc Date: Wed, 21 Oct 2026 12:06:35 +0000 Subject: [PATCH] fix(derived): repair the validation rows for MPE_DERIVED Four stray insert lines and a missing one left the MPE_VALIDATIONS block for MPE_DERIVED malformed, so makedata aborted and the control table was never created - found by building the library on a real estate. The format assertions in the test now read the emitted statement, because proc contents on a view does not report a format in full ('DATE' for DATE9.). --- sas/sasjs/macros/mpe_derived.test.sas | 15 ++++++++------- sas/sasjs/macros/mpe_makedata.sas | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sas/sasjs/macros/mpe_derived.test.sas b/sas/sasjs/macros/mpe_derived.test.sas index 1c6624e..341453d 100644 --- a/sas/sasjs/macros/mpe_derived.test.sas +++ b/sas/sasjs/macros/mpe_derived.test.sas @@ -138,13 +138,14 @@ run; outds=work.test_results ) -/* the label is the variable name plus the expression, and the format from the length */ +/* proc contents on a view reports a format name without its width, so the + format is compared on the name only */ proc contents noprint data=work.vw_derived out=work.vw_cols(keep=name label format); run; data work.chk1d; set work.vw_cols; - where name='BAND' and label='Age band' and format='$8.'; + where name='BAND' and label='Age band' and format=:'$'; run; %mp_assertdsobs(work.chk1d, desc=Test1 - the label and default format are applied, @@ -178,12 +179,12 @@ quit; outvars=work.derived_vars2 ) -proc contents noprint data=work.vw_derived2 - out=work.vw_cols2(keep=name label format); -run; +/* asserted on the emitted statement - proc contents on a view does not + report the format in full */ data work.chk2; - set work.vw_cols2; - where name='FLAG_DT' and format='DATE9.'; + infile derref2 truncover; + input line $4000.; + if index(line,'format=DATE9.')>0 then output; run; %mp_assertdsobs(work.chk2, desc=Test2 - the configured format is applied, diff --git a/sas/sasjs/macros/mpe_makedata.sas b/sas/sasjs/macros/mpe_makedata.sas index 17279f0..2d8b824 100644 --- a/sas/sasjs/macros/mpe_makedata.sas +++ b/sas/sasjs/macros/mpe_makedata.sas @@ -2015,9 +2015,6 @@ insert into &lib..MPE_VALIDATIONS set tx_from=0,base_lib="&lib",base_ds="MPE_DERIVED",base_col="VAR_DEPS" ,rule_type='HARDREGEX',rule_value='^[A-Za-z0-9_ ]*$',rule_active=1 ,tx_to='31DEC5999:23:59:59'dt; -insert into &lib..MPE_VALIDATIONS set -insert into &lib..MPE_VALIDATIONS set -insert into &lib..MPE_VALIDATIONS set insert into &lib..MPE_VALIDATIONS set tx_from=0,base_lib="&lib",base_ds="MPE_DERIVED",base_col="VAR_TYPE" ,rule_type='NOTNULL',rule_value=' ',rule_active=1