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

I am passing month and dates macro variables using the Parameter (macro variable) Manager in EG to a remote session. &Month is classifed as string while &date1 and &date2 are integers. I then use the following codes:

%syslput rmonth=%bquote(&month);
%syslput rdate1=&date1;
%syslput rdate2=&date2;

rsubmit;
%put &rmonth. &rdate1. &rdate2.;
proc contents data = ASPCCR.Cmsambs&rdate1.&rdate2.;
run;
proc contents data = TRIAD.Base_&rmonth.;
run;
endrsubmit;

And here's the log excerpt. I can see the local macro variables were passed correctly remotely but it will not recognised JUN12 (&rmonth). Can anyone help please? I tried restricting the string length to 5 but still the same error. Also checked that TRIAD.Base_JUN12 exists and the code runs smoothly without macro variables.

SYMBOLGEN:  Macro variable MONTH resolves to JUN12
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
17       
18        %syslput rmonth=%bquote(&month);
SYMBOLGEN:  Macro variable DATE1 resolves to 1206
19        %syslput rdate1=&date1;
SYMBOLGEN:  Macro variable DATE2 resolves to 29
20        %syslput rdate2=&date2;
21       
22        rsubmit;
NOTE: Remote submit to CREDIT commencing.
13    %put &rmonth. &rdate1. &rdate2.;
JUN12 1206 29


14    proc contents data = ASPCCR.Cmsambs&rdate1.&rdate2.;
15    run;

NOTE: PROCEDURE CONTENTS used (Total process time):
      real time          0:00.03
      cpu time            0:00.03
     
NOTE: The PROCEDURE CONTENTS printed pages 20-38.

16    proc contents data = TRIAD.Base_&rmonth.;
NOTE: Line generated by the macro variable "RMONTH".
16    TRIAD.Base_JUN12
                  -----
                  22
                    -----
                    202
ERROR: File TRIAD.BASE_.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, CENTILES, DATA, DETAILS, DIR, DIRECTORY, FMTLEN, LIB, MEMTYPE,
              MT, MTYPE, NODETAILS, NODS, NOPRINT, ORDER, OUT, OUT2, SHORT, VARNUM. 
ERROR 202-322: The option or parameter is not recognized and will be ignored.
17    run;

NOTE: Statements not processed because of errors noted above.
2                                                          The SAS System                        09:51 Wednesday, November 14, 2012

NOTE: PROCEDURE CONTENTS used (Total process time):
      real time          0:00.00
      cpu time            0:00.02
     
NOTE: The SAS System stopped processing this step because of errors.
NOTE: Remote submit to CREDIT complete.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

The %BQUOTE() is causing the tokenizer to incorrectly stop before &rmonth value when trying to parse the name of the dataset.

Try doing something to remove the quoting. Such as :

proc contents data = %unquote(TRIAD.Base_&rmonth.) ;


Why are you using %BQUOTE()?  It looks like you want the use the value the macro variable MONTH that is defined in the remote session rather than the value in the local session.  Are they really different? 

View solution in original post

7 REPLIES 7
Tom
Super User Tom
Super User

The %BQUOTE() is causing the tokenizer to incorrectly stop before &rmonth value when trying to parse the name of the dataset.

Try doing something to remove the quoting. Such as :

proc contents data = %unquote(TRIAD.Base_&rmonth.) ;


Why are you using %BQUOTE()?  It looks like you want the use the value the macro variable MONTH that is defined in the remote session rather than the value in the local session.  Are they really different? 

Koon
Calcite | Level 5

Hi Tom,

It had a different error if I don't use %bquote. It's REALLY bizarre but yur suggestion to unquote it works beautifully. Thanks!

21         rsubmit;
NOTE: Remote submit to CREDIT commencing.
21    %put &rmonth. &rdate1. &rdate2.;
JUN12 1206 29
22    /*proc contents data = ASPCCR.Cmsambs&rdate1.&rdate2.;*/
23    /*run;*/
24    proc contents data = TRIAD.Base_&rmonth.;

      -----
      22
      202
ERROR: File TRIAD.BASE_.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, CENTILES, DATA, DETAILS, DIR, DIRECTORY, FMTLEN, LIB, MEMTYPE,
              MT, MTYPE, NODETAILS, NODS, NOPRINT, ORDER, OUT, OUT2, SHORT, VARNUM. 
ERROR 202-322: The option or parameter is not recognized and will be ignored.
25    run;

NOTE: Statements not processed because of errors noted above.
NOTE: PROCEDURE CONTENTS used (Total process time):
      real time           0:00.04
      cpu time            0:00.03

RichardinOz
Quartz | Level 8

It is odd that the first proc contents worked while the second did not.  I'm guessing ASPCCR is a stock SAS library while TRIAD is a SAS/Access libname.

Why are you using %BQUOTE()? All macro variables are strings, no need to try and "quote" them (which has a different effect in SAS Macro language).

Try

%syslput rmonth=&month;

If for some reason you must use %BQUOTE() then at the rsubmit

rsubmit;

%let rmonth = %unquote(&rmonth);


Richard in Oz

Koon
Calcite | Level 5

Hey Richard,

Yes it doesn't work without the %bquote (see response to Tom above). Your suggestion to unquote works beautifully. Thanks!

RichardinOz
Quartz | Level 8

Suggests to me that the problem is created further up in your code wherever &month is initially assigned.  JUN12 is a perfectly ordinary string value and it should not need to be wrapped in %BQUOTE().  I would insert the line


%let month = %unquote(&month);

well before the %syslput rmonth= statement to prevent all downstream issues with &month and &rmonth.

Richard in Oz

Koon
Calcite | Level 5

That's exactly what I think also, Richard. The code provided is the complete code - I suspect the EG Parameter Manager does something funny with string macro variables. When I searched online, SAS suggested using %bquote with %syslput in SAS 9.

RichardinOz
Quartz | Level 8

OK, I forgot this thing had EG wrapped around it.  Anything can happen.  I'll bear it in mind if I ever have to %syslput in EG.

Richard in Oz

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1514 views
  • 3 likes
  • 3 in conversation