From d72ca7cb2456ac57801eeb0980b9f0836a318537 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Mon, 27 Sep 2021 12:30:28 +0100 Subject: [PATCH] fix: warning in mp_assertcolvals from outobs sql option --- all.sas | 19 ++++++++++++++++--- base/mp_assertcolvals.sas | 19 ++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/all.sas b/all.sas index 9b56154..c2e5e43 100644 --- a/all.sas +++ b/all.sas @@ -2188,6 +2188,7 @@ Usage:

SAS Macros

@li mf_existds.sas + @li mf_getuniquename.sas @li mf_nobs.sas @li mp_abort.sas @@ -2273,13 +2274,25 @@ Usage: select count(*) into: orig from &lib..&ds; quit; - %local notfound; - proc sql outobs=10 noprint; - select distinct &col into: notfound separated by ' ' + %local notfound tmp1 tmp2; + %let tmp1=%mf_getuniquename(); + %let tmp2=%mf_getuniquename(); + + /* this is a bit convoluted - but using sql outobs=10 throws warnings */ + proc sql noprint; + create view &tmp1 as + select distinct &col from &lib..&ds where &col not in ( select &ccol from &clib..&cds ); + data &tmp2; + set &tmp1; + if _n_>10 then stop; + run; + proc sql; + select distinct &col into: notfound separated by ' ' from &tmp2; + %mp_abort(iftrue= (&syscc ne 0) ,mac=&sysmacroname diff --git a/base/mp_assertcolvals.sas b/base/mp_assertcolvals.sas index 5ee518c..7176782 100644 --- a/base/mp_assertcolvals.sas +++ b/base/mp_assertcolvals.sas @@ -30,6 +30,7 @@

SAS Macros

@li mf_existds.sas + @li mf_getuniquename.sas @li mf_nobs.sas @li mp_abort.sas @@ -115,13 +116,25 @@ select count(*) into: orig from &lib..&ds; quit; - %local notfound; - proc sql outobs=10 noprint; - select distinct &col into: notfound separated by ' ' + %local notfound tmp1 tmp2; + %let tmp1=%mf_getuniquename(); + %let tmp2=%mf_getuniquename(); + + /* this is a bit convoluted - but using sql outobs=10 throws warnings */ + proc sql noprint; + create view &tmp1 as + select distinct &col from &lib..&ds where &col not in ( select &ccol from &clib..&cds ); + data &tmp2; + set &tmp1; + if _n_>10 then stop; + run; + proc sql; + select distinct &col into: notfound separated by ' ' from &tmp2; + %mp_abort(iftrue= (&syscc ne 0) ,mac=&sysmacroname