Remote SAS 'call Symput' Fails to work

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Remote SAS 'call Symput' Fails to work

Can anyone explain why SAS on Unix (remote submit) does not create my macro variables correctly? This code works on PC SAS side but seems to choke (with no error) on the UNIX SAS side of things.. Thanks! Smiley Happy

%MACRO EDW2;

RSUBMIT;

data _null_;
format dtstr1 dtstr2 dtstr3 DATE9.;
dtstr1 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'BEGINNING');
dtstr2 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'END');
dtstr3 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),-1,'END');
call SYMPUT('RPTMTH',put(dtstr1,YYMMN.));
call SYMPUT('BEGPRIOR',put(dtstr1,DATE9.));
call SYMPUT('DATADT',put(dtstr2,DATE9.));
call SYMPUT('ODATE',"'"||put(dtstr2,date7.)||"'");
call SYMPUT('PDATE',"'"||put(dtstr3,date7.)||"'");
run;

%put RPTMTH = "&RPTMTH." BEGPRIOR = "&BEGPRIOR." DATADT = "&DATADT." ODATE = "&ODATE." PDATE = "&PDATE.";

ENDRSUBMIT;

%MEND EDW2;
%EDW2;

Log Results:

1776  %MACRO EDW2;
1777
1778  RSUBMIT;
1779
1781  data _null_;
1782  format dtstr1 dtstr2 dtstr3 DATE9.;
1783  dtstr1 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'BEGINNING');
1784  dtstr2 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'END');
1785  dtstr3 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),-1,'END');
1786  call SYMPUT('RPTMTH',put(dtstr1,YYMMN.));
1787  call SYMPUT('BEGPRIOR',put(dtstr1,DATE9.));
1788  call SYMPUT('DATADT',put(dtstr2,DATE9.));
1789  call SYMPUT('ODATE',"'"||put(dtstr2,date7.)||"'");
1790  call SYMPUT('PDATE',"'"||put(dtstr3,date7.)||"'");
1791  run;
1792
1793  %put RPTMTH = "&RPTMTH." BEGPRIOR = "&BEGPRIOR." DATADT = "&DATADT." ODATE = "&ODATE." PDATE
1793!  = "&PDATE.";
1794
1795  ENDRSUBMIT;
1796
1797  %MEND EDW2;
1798  %EDW2;
MLOGIC(EDW2):  Beginning execution.
MPRINT(EDW2):   RSUBMIT
NOTE: Remote submit to REMOTEID commencing.
MPRINT(EDW2):  ; data _null_;
MPRINT(EDW2):   format dtstr1 dtstr2 dtstr3 DATE9.;
MPRINT(EDW2):   dtstr1 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'BEGINNING');
MPRINT(EDW2):   dtstr2 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'END');
MPRINT(EDW2):   dtstr3 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),-1,'END');
MPRINT(EDW2):   call SYMPUT('RPTMTH',put(dtstr1,YYMMN.));
MPRINT(EDW2):   call SYMPUT('BEGPRIOR',put(dtstr1,DATE9.));
MPRINT(EDW2):   call SYMPUT('DATADT',put(dtstr2,DATE9.));
MPRINT(EDW2):   call SYMPUT('ODATE',"'"||put(dtstr2,date7.)||"'");
MPRINT(EDW2):   call SYMPUT('PDATE',"'"||put(dtstr3,date7.)||"'");
MPRINT(EDW2):   run;
MLOGIC(EDW2):  %PUT RPTMTH = "&RPTMTH." BEGPRIOR = "&BEGPRIOR." DATADT = "&DATADT." ODATE =
      "&ODATE." PDATE = "&PDATE."
WARNING: Apparent symbolic reference RPTMTH not resolved.
WARNING: Apparent symbolic reference BEGPRIOR not resolved.
WARNING: Apparent symbolic reference DATADT not resolved.
WARNING: Apparent symbolic reference ODATE not resolved.
WARNING: Apparent symbolic reference PDATE not resolved.
RPTMTH = "&RPTMTH." BEGPRIOR = "&BEGPRIOR." DATADT = "&DATADT." ODATE = "&ODATE." PDATE =
"&PDATE."
MPRINT(EDW2):   ENDRSUBMIT;
749   data _null_;
750   format dtstr1 dtstr2 dtstr3 DATE9.;
751   dtstr1 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'BEGINNING');
752   dtstr2 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),+0,'END');
753   dtstr3 = INTNX('MONTH',(INTNX('MONTH',date(),-1)),-1,'END');
754   call SYMPUT('RPTMTH',put(dtstr1,YYMMN.));
755   call SYMPUT('BEGPRIOR',put(dtstr1,DATE9.));
756   call SYMPUT('DATADT',put(dtstr2,DATE9.));
757   call SYMPUT('ODATE',"'"||put(dtstr2,date7.)||"'");
758   call SYMPUT('PDATE',"'"||put(dtstr3,date7.)||"'");
759   run;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


NOTE: Remote submit to REMOTEID complete.
MLOGIC(EDW2):  Ending execution.


Accepted Solutions
Solution
‎09-16-2013 06:52 PM
Occasional Contributor
Posts: 7

Re: Remote SAS 'call Symput' Fails to work

The problem is resolved when I move the %macro start and end to within the RSUBMIT and ENDRSUBMIT statement. The macro being active only on the local side made it work incorrectly...

View solution in original post


All Replies
Solution
‎09-16-2013 06:52 PM
Occasional Contributor
Posts: 7

Re: Remote SAS 'call Symput' Fails to work

The problem is resolved when I move the %macro start and end to within the RSUBMIT and ENDRSUBMIT statement. The macro being active only on the local side made it work incorrectly...

Super User
Super User
Posts: 6,502

Re: Remote SAS 'call Symput' Fails to work

Another way is to prevent the local session from evaluating the macro statements by using %NRSTR().

%macro xx;

rsubmit;

data _null_;

  call symputx('newvar','remote');

run;

%nrstr(%put &newvar) ;

endrsubmit;

%mend xx;

%xx;

Occasional Contributor
Posts: 7

Re: Remote SAS 'call Symput' Fails to work

Thank you Tom! I will try that too! Smiley Happy

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 551 views
  • 3 likes
  • 2 in conversation