BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

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&param1.;

/*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&param1...xml;

    

/*Transfering local variable to remote host*/

 

     %syslput _LOCAL_ /REMOTE=sess&param1.;

     rsubmit sess&param1. wait=no; 

 

/*Checking global variable*/

    

          %put &param1.;

          %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&param1.","&mylib.",'xml','xmltype=oracle');

run;           

    

/*Converting the dataset to XML file*/

    

          %put lib&param1.||"after the libname call";

          %put &&FileName&param1.||"after the libname call";

 

          data lib&param1..&&Filename&param1.;

          set mydata.&&Filename&param1.;

          run;

         

libname mylib clear;

libname lib&param1. 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;

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.),'));'));

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 7721 views
  • 1 like
  • 2 in conversation