From 11d073c10a258ade7873139fcc91a57cc21281f3 Mon Sep 17 00:00:00 2001 From: munja Date: Tue, 25 Jan 2022 00:49:26 +0100 Subject: [PATCH] fix: comma placement in mp_stackdiffs.sas --- all.sas | 13 +++++++++++-- base/mp_stackdiffs.sas | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/all.sas b/all.sas index 8bb711d..8ea36cd 100644 --- a/all.sas +++ b/all.sas @@ -10270,16 +10270,25 @@ select distinct tgtvar_nm into: missvars separated by ' ' file &fref; set &auditlibds(where=(move_type='M')) end=lastobs; by key_hash; + retain comma 'N'; if _n_=1 then put 'proc sql;'; - if first.key_hash then put "update &outmod set " / ' '@@; + if first.key_hash then do; + comma='N'; + put "update &outmod set " @@; + end; if is_diff=1 then do; - if not first.key_hash then put ' ,'@@; + if comma='N' then do; + put ' '@@; + comma='Y'; + end; + else put ' ,'@@; if tgtvar_type='C' then do; length qstr $32767; qstr=quote(trim(NEWVAL_CHAR)); put tgtvar_nm '=' qstr; end; else put tgtvar_nm '=' newval_num; + if comma=' ' then comma=' ,'; end; if last.key_hash then put ' where key_hash=trim("' key_hash '");'; if lastobs then put "alter table &outmod drop key_hash;"; diff --git a/base/mp_stackdiffs.sas b/base/mp_stackdiffs.sas index 1831d7e..292a19b 100644 --- a/base/mp_stackdiffs.sas +++ b/base/mp_stackdiffs.sas @@ -559,16 +559,25 @@ select distinct tgtvar_nm into: missvars separated by ' ' file &fref; set &auditlibds(where=(move_type='M')) end=lastobs; by key_hash; + retain comma 'N'; if _n_=1 then put 'proc sql;'; - if first.key_hash then put "update &outmod set " / ' '@@; + if first.key_hash then do; + comma='N'; + put "update &outmod set " @@; + end; if is_diff=1 then do; - if not first.key_hash then put ' ,'@@; + if comma='N' then do; + put ' '@@; + comma='Y'; + end; + else put ' ,'@@; if tgtvar_type='C' then do; length qstr $32767; qstr=quote(trim(NEWVAL_CHAR)); put tgtvar_nm '=' qstr; end; else put tgtvar_nm '=' newval_num; + if comma=' ' then comma=' ,'; end; if last.key_hash then put ' where key_hash=trim("' key_hash '");'; if lastobs then put "alter table &outmod drop key_hash;";