From 1ef42d45af9c42c6e2228e26472fc941ae8c2e95 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Mon, 3 May 2021 22:43:56 +0300 Subject: [PATCH] fix: wrapping filter query in brackets to allow logic to be encapsulated when using with other logic sources --- all.sas | 3 ++- base/mp_filtergenerate.sas | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/all.sas b/all.sas index f391764..54a4686 100644 --- a/all.sas +++ b/all.sas @@ -3309,13 +3309,14 @@ filename &outref temp; file &outref lrecl=32800; set &inds end=last; by SUBGROUP_ID; - if _n_=1 then put '('; + if _n_=1 then put '(('; else if first.SUBGROUP_ID then put +1 GROUP_LOGIC '('; else put +2 SUBGROUP_LOGIC; put +4 VARIABLE_NM OPERATOR_NM RAW_VALUE; if last.SUBGROUP_ID then put ')'@; + if last then put ')'; run; %end; diff --git a/base/mp_filtergenerate.sas b/base/mp_filtergenerate.sas index a0005e7..7654bf8 100644 --- a/base/mp_filtergenerate.sas +++ b/base/mp_filtergenerate.sas @@ -88,13 +88,14 @@ filename &outref temp; file &outref lrecl=32800; set &inds end=last; by SUBGROUP_ID; - if _n_=1 then put '('; + if _n_=1 then put '(('; else if first.SUBGROUP_ID then put +1 GROUP_LOGIC '('; else put +2 SUBGROUP_LOGIC; put +4 VARIABLE_NM OPERATOR_NM RAW_VALUE; if last.SUBGROUP_ID then put ')'@; + if last then put ')'; run; %end;