Hello,
I would like to convert SAS dataset into xml file using parallel processing and instead of using a do loop statement in a project, it was recommended to use a call execute statement (see the code below as well as the attaché log file).
However, when I execute the code, the xml file are generated but I receive the error message shown in the subject section.
I made many tests to eliminate this error but without success.
Does someone could help me with that issue.
Regards,
%macro test3(param1= );
/*Telling to SAS we want to start a parallel process*/
options sascmd="!SASCMD";
/*Assigining a Thread to a CPU*/
SIGNON sess¶m1.;
/*Declaring local variable*/
%let FileName1=data_2_500000;
%let FileName2=data_5_500000;
%let FileName3=data_10_500000;
%let FileName4=data_20_500000;
%let mylib=\\SFPFI4335.PROD.MRQ\Usagers-DGTT\RLEA109\Documents\Test\Parallel Processing\XML\&&FileName¶m1...xml;
/*Transfering local variable to remote host*/
%syslput _LOCAL_ /REMOTE=sess¶m1.;
rsubmit sess¶m1. wait=no;
/*Checking global variable*/
%put ¶m1.;
%put &FileName1;
%put &FileName2;
%put &FileName3;
%put &FileName4;
%put &mylib;
/*Declaring the libraries ******/
libname mydata "\\SFPFI4335.PROD.MRQ\Usagers-DGTT\RLEA109\Documents\Test\Parallel Processing\Data";
data _null_;
rc=libname("lib¶m1.","&mylib.",'xml','xmltype=oracle');
run;
/*Converting the dataset to XML file*/
%put lib¶m1.||"after the libname call";
%put &&FileName¶m1.||"after the libname call";
data lib¶m1..&&Filename¶m1.;
set mydata.&&Filename¶m1.;
run;
libname mylib clear;
libname lib¶m1. clear;
/*********************************************/
endrsubmit;
/*End of the session*/
%mend test3;
/*
%test3(param1=1);
%test3(param1=2);
%test3(param1=3);
%test3(param1=4);
*/
Data _null_;
do j=1 to 4;
call execute(cats('%test3(param1=',put(j,best.),');'));
end;
run;
ALWAYS test your SAS code before you put it into a macro definition, so you get a clearer log where the ERROR message immediately follows the incriminated statement.
But in your case, it seems to be the way you call the macro in call execute. You have to mask the macro call, or the macro statements (in your case %syslput) will be executed prematurely, before the Base SAS code (the rsubmit statement) has come into effect.
Change the call execute to
call execute(cats('%nrstr(%test3(param1=',put(j,best.),'));'));
ALWAYS test your SAS code before you put it into a macro definition, so you get a clearer log where the ERROR message immediately follows the incriminated statement.
But in your case, it seems to be the way you call the macro in call execute. You have to mask the macro call, or the macro statements (in your case %syslput) will be executed prematurely, before the Base SAS code (the rsubmit statement) has come into effect.
Change the call execute to
call execute(cats('%nrstr(%test3(param1=',put(j,best.),'));'));
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.