From 0361ca574d898e916ecdcc7c479aeccf0e316017 Mon Sep 17 00:00:00 2001 From: munja Date: Wed, 29 Dec 2021 12:19:34 +0000 Subject: [PATCH] fix: preventing error when mp_applyformats has no formats to apply --- all.sas | 4 ++-- base/mp_applyformats.sas | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/all.sas b/all.sas index 25b004e..be7b4d4 100644 --- a/all.sas +++ b/all.sas @@ -2478,16 +2478,16 @@ run; proc sql noprint; select distinct lib into: liblist separated by ' ' from &inds; %put &=liblist; -%do i=1 %to %sysfunc(countw(&liblist)); +%if %length(&liblist)>0 %then %do i=1 %to %sysfunc(countw(&liblist)); %let lib=%scan(&liblist,1); %let engine=%mf_getengine(&lib); %if &engine ne V9 and &engine ne BASE %then %do; %let msg=&lib has &engine engine - formats cannot be applied; - proc sql; insert into &outds set lib="&lib",ds="_all_",var="_all", msg="&msg" ; %if &errds=0 %then %put %str(ERR)OR: &msg; %end; %end; +quit; %if %mf_nobs(&outds)>0 %then %return; diff --git a/base/mp_applyformats.sas b/base/mp_applyformats.sas index d6b4b83..06f4964 100644 --- a/base/mp_applyformats.sas +++ b/base/mp_applyformats.sas @@ -142,16 +142,16 @@ run; proc sql noprint; select distinct lib into: liblist separated by ' ' from &inds; %put &=liblist; -%do i=1 %to %sysfunc(countw(&liblist)); +%if %length(&liblist)>0 %then %do i=1 %to %sysfunc(countw(&liblist)); %let lib=%scan(&liblist,1); %let engine=%mf_getengine(&lib); %if &engine ne V9 and &engine ne BASE %then %do; %let msg=&lib has &engine engine - formats cannot be applied; - proc sql; insert into &outds set lib="&lib",ds="_all_",var="_all", msg="&msg" ; %if &errds=0 %then %put %str(ERR)OR: &msg; %end; %end; +quit; %if %mf_nobs(&outds)>0 %then %return;