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;
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));
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;
Same result, it did not run through..
yeah there is nothing created in my remote work library.
Are you sure
prod.Tdaf_var_nonprime_&dt2.
exists?
If the libref PROD even defined?
yes. plus, if it doesn't exit, it will execute the 'else do' step.
How did you get explorer to show you a list of files for a libref defined in a remote session?
like this?
rsubmit;
libname prod 'xxxxxxxxxxxxxxxxxxxxxxx';
endrsubmit;
libname prod server=&rsession;
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));
I think it works now! Thank you!!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: