BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

 

I made 4 programs project.

1 Declaring FileName as global variables

2 Declaring Libname

3 Converting 4 datasets (4 FileName) into xml file.

4 converting 4 Datasets into xml using parallel process.

 

The first 3 programs goes well but the flux stop with the program # 4.

I disconnect my session then I reconnect.

After that, I am able to execute the last program without any error.

 

Does someone could explain me why this thing append and what can I do to solve this problem to permit my flux to be executed from the beginning to the end?

 

Thanks in advance for your help.

 

4 REPLIES 4
ChrisHemedinger
Community Manager

Hi @alepage,

 

This is tricky to diagnose if you're not sharing the log with the error.  Can you post that, or at least code/lines with the error reporting?

 

Chris

SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.
alepage
Barite | Level 11

Hello,

 

Here's the program

I will try to include the two log files(executed alone, then in a project)

 

options MPRINT MLOGIC SYMBOLGEN;

%let st_tm=%SYSFUNC(time(),time.); /* Set the current time as the start time. */

%macro test2;

%do i=1 %to 1 ;

/*Telling to SAS we want to start a parallel process*/

options sascmd="!SASCMD";

 

 

/*Assigining a Thread to a CPU*/

SIGNON sess&i;

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

 

 

/*Transfering local variable to remote host*/

%syslput _LOCAL_ /REMOTE=sess&i;

 

rsubmit sess&i wait=no;

/*Checking global variable*/

 

%put &i;

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

 

run;

 

/*Converting the dataset to XML file*/

 

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

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

data lib&i..&&Filename&i.;

set mydata.&&Filename&i.;

 

run;

 

libname mylib clear;

libname lib&i. clear;

 

 

/*********************************************/

 

endrsubmit;

/*End of the session*/

%end;

waitfor _all_; /* Wait for both RSUBMITs to complete. */

SIGNOFF _all_; /*End both SAS sessions. */

%mend test2;

 

%test2;

libname _all_ clear;

%let en_tm=%SYSFUNC(time(),time.) ; /* Set the complete time. */

data _null_; /* Calculate the delay. */

st_tm="&st_tm"t;

en_tm="&en_tm"t;

int=intck('seconds',st_tm,en_tm);

put "Interval is " int "seconds.";

run;

 

 

SASKiwi
PROC Star

Remove your macro logic and retest.

 

As a general rule I strongly advise against doing remote submits inside a macro. This is because your remote sessions know nothing about being run inside a macro and it can easily result in unexpected program behaviour.

 

If you want to repeat your code then using alternative methods like CALL EXECUTE is better.

 

One obvious problem with your program is the MYLIB macro variable is not being passed to the remote session.

 

 

alepage
Barite | Level 11

Hello,

 

I have retrieved the macro logic but it did not solve the problem.

 

Regarding the option to use call execute to replace the do loop, I understand what you mean but I don't know how to replace the do loop by the call execute.

 

Could you, please, provide me an example how to do it

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1113 views
  • 1 like
  • 3 in conversation