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

Hi.. I am trying to remote submit the following SAS code but the log returns 'remote submit complete' without even running it.. Anyone knows what is wrong with my code?

 

Here is the log message:

NOTE: Remote submit to commencing.
381 %extract(d1 = 01MAY2019, d2 = 31JUL2019);
NOTE: Remote submit to complete.

 

rsubmit;
%macro extract(d1=, d2=);
%let start_date = &d1.;
%let end_date = &d2.;

%let i = 1;
%let dt1 = &start_date.;

%do %while ("&dt1."d <= "&end_date."d);
	%let dt1 = %sysfunc(putn("&dt1."d, date9.));

	%let dt2 = &dt1.;
	%let dt2 = %sysfunc(putn("&dt1."d, yymmddn8.));

	%let dt3 = %sysfunc(intnx(day, "&dt1."d, -1, s), date9.);

	%if %sysfunc(exist(prod.Tdaf_var_nonprime_&dt2.)) %then %do;
		data dataset_&dt2.;
        	set prod.dataset_&dt2. (obs = 10);
    	run;
	%let dt1 = %sysfunc(intnx(day, "&dt1."d, 1, s), date9.);
	%let i = %eval(&i. + 1);

	%end;

	%else %let dt1 = %sysfunc(intnx(day, "&dt1."d, 1, s), date9.);

%end;

%let m = %eval(&i. - 1);

%mend;
endrsubmit;

rsubmit;
%extract(d1 = 01MAY2019, d2 = 31JUL2019);
endrsubmit;
1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

I doubt that macro language can compute this comparison properly:

 

%do %while ("&dt1."d <= "&end_date."d);

 

Try it this way:

 

%do %while (%sysevalf("&dt1."d <= "&end_date."d));

 

View solution in original post

12 REPLIES 12
Reeza
Super User

Do the macro submission and call in the same rsubmit block and see what happens.

 


@newboy1218 wrote:

Hi.. I am trying to remote submit the following SAS code but the log returns 'remote submit complete' without even running it.. Anyone knows what is wrong with my code?

 

Here is the log message:

NOTE: Remote submit to commencing.
381 %extract(d1 = 01MAY2019, d2 = 31JUL2019);
NOTE: Remote submit to complete.

 

rsubmit;
%macro extract(d1=, d2=);
%let start_date = &d1.;
%let end_date = &d2.;

%let i = 1;
%let dt1 = &start_date.;

%do %while ("&dt1."d <= "&end_date."d);
	%let dt1 = %sysfunc(putn("&dt1."d, date9.));

	%let dt2 = &dt1.;
	%let dt2 = %sysfunc(putn("&dt1."d, yymmddn8.));

	%let dt3 = %sysfunc(intnx(day, "&dt1."d, -1, s), date9.);

	%if %sysfunc(exist(prod.Tdaf_var_nonprime_&dt2.)) %then %do;
		data dataset_&dt2.;
        	set prod.dataset_&dt2. (obs = 10);
    	run;
	%let dt1 = %sysfunc(intnx(day, "&dt1."d, 1, s), date9.);
	%let i = %eval(&i. + 1);

	%end;

	%else %let dt1 = %sysfunc(intnx(day, "&dt1."d, 1, s), date9.);

%end;

%let m = %eval(&i. - 1);

%mend;
endrsubmit;

rsubmit;
%extract(d1 = 01MAY2019, d2 = 31JUL2019);
endrsubmit;

 

newboy1218
Quartz | Level 8

Same result, it did not run through..

Reeza
Super User
Are you sure? Where are you looking for the results, in the remote work library right? I'm assuming you're connected to that somehow?
newboy1218
Quartz | Level 8

yeah there is nothing created in my remote work library.

Tom
Super User Tom
Super User

Are you sure 

prod.Tdaf_var_nonprime_&dt2.

exists? 

If the libref PROD even defined?

newboy1218
Quartz | Level 8

yes. plus, if it doesn't exit, it will execute the 'else do' step.

 

Capture.PNG

Tom
Super User Tom
Super User

How did you get explorer to show you a list of files for a libref defined in a remote session?

newboy1218
Quartz | Level 8

like this?

 

rsubmit;
libname prod 'xxxxxxxxxxxxxxxxxxxxxxx'; 
endrsubmit;

libname prod server=&rsession;
Reeza
Super User
First option here is usually what I use to separate the remote from local.
http://support.sas.com/kb/24/836.html

OP, data set is being written to the remote WORK library, not the PROD library.
Reeza
Super User
At this point I'd probably restart and see if it works or not.
Astounding
PROC Star

I doubt that macro language can compute this comparison properly:

 

%do %while ("&dt1."d <= "&end_date."d);

 

Try it this way:

 

%do %while (%sysevalf("&dt1."d <= "&end_date."d));

 

newboy1218
Quartz | Level 8

I think it works now! Thank you!!

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 12 replies
  • 1668 views
  • 5 likes
  • 4 in conversation