From 899b94bb6e096fb4368e272f3f84ae6d5ca3d88e Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Thu, 7 Jul 2022 10:28:24 +0000 Subject: [PATCH] fix: iftrue parameter for mp_binarycopy. Closes #277 --- all.sas | 5 +++++ base/mp_binarycopy.sas | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/all.sas b/all.sas index 283cb33..aa5a768 100644 --- a/all.sas +++ b/all.sas @@ -3505,6 +3505,7 @@ run; @param [in] mode (CREATE) Valid values: @li CREATE - Create the file (even if it already exists) @li APPEND - Append to the file (don't overwrite) + @param iftrue= (1=1) Supply a condition for which the macro should be executed @returns nothing @@ -3518,8 +3519,12 @@ run; ,inref=____in /* override default to use own filerefs */ ,outref=____out /* override default to use own filerefs */ ,mode=CREATE + ,iftrue=%str(1=1) )/*/STORE SOURCE*/; %local mod; + + %if not(%eval(%unquote(&iftrue))) %then %return; + %if &mode=APPEND %then %let mod=mod; /* these IN and OUT filerefs can point to anything */ diff --git a/base/mp_binarycopy.sas b/base/mp_binarycopy.sas index b6b3d04..8a8502c 100755 --- a/base/mp_binarycopy.sas +++ b/base/mp_binarycopy.sas @@ -31,6 +31,7 @@ @param [in] mode (CREATE) Valid values: @li CREATE - Create the file (even if it already exists) @li APPEND - Append to the file (don't overwrite) + @param iftrue= (1=1) Supply a condition for which the macro should be executed @returns nothing @@ -44,8 +45,12 @@ ,inref=____in /* override default to use own filerefs */ ,outref=____out /* override default to use own filerefs */ ,mode=CREATE + ,iftrue=%str(1=1) )/*/STORE SOURCE*/; %local mod; + + %if not(%eval(%unquote(&iftrue))) %then %return; + %if &mode=APPEND %then %let mod=mod; /* these IN and OUT filerefs can point to anything */