Hello @Reeza, thanks for your input and help on this. I did try and modified my code. I have a comment on the code where I am calling the macro manually it does work and it unload the table from ADHLASR LASR library. /*%deletedsifexists(ADHLASR, JUNK); --it does works like this and it does unload the table from LASR*/
/*%deletedsifexists(ADHLASR, SASTESTING); --it does works like this and it does unload the table from LASR*/ But when I run this statement it runs, no warning or error messages but it does not unload the table data _null_;
set work.mytable;
call execute('%deletedsifexists('||ADHLASR||','||STRING1_VALUE||')'); /* This will run, no error or warning but it does not unload the table */
run; Here is the full program, again much appreciated for any feedback and help. %let _ENCODING=UTF-8;
libname LIBPROD meta Library = EPROD;
/* The following query will return two observation. They are called SASTESTING and JUNK.
This is the name of the two tables that I need to unload using the following Macro */
PROC SQL noprint;
CREATE TABLE work.mytable AS
SELECT STRING1_VALUE
FROM LIBPROD.REPORTDATA lp
WHERE lp.LIST_NAM = 'SASLASRDataLoads'
AND lp.STRING5_VALUE = 'true';
QUIT;
/*%macro disablelisting; */
/* /* Disable listing file output */ */
/*filename nulpath dummy; */
/*proc printto print = nulpath; */
/*run; */
/*%mend; */
/*%disablelisting; */
options VALIDVARNAME=ANY VALIDMEMNAME=EXTEND;
/* Status Checkpoint Macro */
%macro statuscheckpoint(maxokstatus=4, varstocheck=SYSERR SYSLIBRC SYSDBRC );
%GLOBAL LASTSTEPRC;
%LET pos=1;
%let var=notset;
%let var=%SCAN(&varstocheck.,&pos.);
%DO %WHILE ("&VAR." ne "");
/* Retrieve the next return code to check */
%if (%symexist(&VAR.)) %then %do;
%let val=&&&VAR..;
%if (("&VAL." ne "") and %eval(&VAL. > &maxokstatus.)) %then %do;
%put FAIL = &VAR.=&VAL. / SYSCC=&SYSCC.;
%let LASTSTEPRC=&VAL.;
%end;
%end;
%let pos = %eval(&pos.+1);
%let var=%SCAN(&varstocheck.,&pos.);
%END;
%mend;
%statuscheckpoint;
/* Skip Next Step If We Have a Bad Status Code */
%macro codeBody;
%GLOBAL LASTSTEPRC;
%if %symexist(LASTSTEPRC) %then %do;
%if %eval(&LASTSTEPRC. <= 4) %then %do;
/* the following statement is modified for privacy reason */
LIBNAME ADHLASR SASIOLA TAG=ADHLASR PORT=11111 SIGNER="https://MySASServer.com:443/SASLASRAuthorization" HOST="MySASSeerver.com" ;
/* Remove data from the server */
%macro deletedsifexists(lib,name);
%if %sysfunc(exist(&lib..&name.)) %then %do;
proc datasets library=&lib. nolist;
delete &name.;
quit;
%end;
%mend deletedsifexists;
data _null_;
set work.mytable;
call execute('%deletedsifexists('||ADHLASR||','||STRING1_VALUE||')'); /* This will run, no error or warning but it does not unload the table */
run;
/*%deletedsifexists(ADHLASR, JUNK); --it does works like this and it does unload the table from LASR*/
/*%deletedsifexists(ADHLASR, SASTESTING); --it does works like this and it does unload the table from LASR*/
%end;
%end;
%mend;
%codeBody;
... View more