BookmarkSubscribeRSS Feed
Gayle
Quartz | Level 8

Hi i am trying to figure out syntax error i am getting.  This is in a data step: Is it from the dosubl or the %finnalload macro being called?


9236
9237      data _null_;
9238      set tables_toload;
9239      put "contact date?";
9240      put contactdtpresent;
9241      put "extenidpresent?";
9242      put externidpresent;
9243      if &loadcnt > 0 then
9244          loadrc = dosubl('%finalload("tablename",contactdtpresent,externidpresent)');
9245      else
9246          put "Nothing to load, no tables passed all validations";
9247      run;

contact date?
0
extenidpresent?
0
ERROR 22-322: Syntax error, expecting one of the following: (, AS, LIKE.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 79-322: Expecting a ).
ERROR 76-322: Syntax error, statement will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: (, SELECT, SET, VALUES.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, VALUES.
ERROR 76-322: Syntax error, statement will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ',', INDEX, TABLE, VIEW.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, ',', ANSIMISS, AS, CROSS,
              EXCEPT, FULL, GROUP, HAVING, INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER,
              OUTER, RIGHT, UNION, WHERE.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: a name, (, ), ',', ANSIMISS, AS, CROSS,
              EXCEPT, FULL, GROUP, HAVING, INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, OUTER,
              RIGHT, UNION, WHERE.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: a name, (, ), ',', ANSIMISS, AS, CROSS,
              EXCEPT, FULL, GROUP, HAVING, INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, OUTER,
              RIGHT, UNION, WHERE.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 180-322: Statement is not valid or it is used out of proper order.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.87 seconds
      cpu time            0.04 seconds

6 REPLIES 6
ballardw
Super User

Your code is showing what appear to be errors generated by the code in your macro %finalload.

 

Where is the value for the macro variable &loadcnt set and what is its value when this data step runs?

 

I suggest setting OPTIONS MPRINT and rerun the code. The Log may then show more details of the code actually generated that may help in debugging either the parameters sent to your macro or the actual macro code itself.

 

Be prepared to share the code that creates the macro Finalload.

Gayle
Quartz | Level 8
MPRINT(FINALLOAD):   proc sql noprint;
MPRINT(FINALLOAD):   connect to teradata as abcd (username="bdxxx"
password="{SAS002}xxxx" tdpid=TDP1 mode=teradata fastload=yes);
ERROR 22-322: Syntax error, expecting one of the following: (, AS, LIKE.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 79-322: Expecting a ).
ERROR 76-322: Syntax error, statement will be ignored

Thanks for the suggestion of MPRINT ! i used it and it is in the macro.  I get this syntax error above below the  connection statement but I don't see what is wrong.  It is like my other connection statements that are working.  Do you see the error?

 

Tom
Super User Tom
Super User

What does the macro do? What are the input parameters to it? How are the parameter values used?

 

Since the macro call seems to have worked all we know so far is that it support at least three positional parameters.

Gayle
Quartz | Level 8
i accepts 3 parameter the first being a string. But the error i get is for the connection statement i think and it looks correct The errors are below the statement correct?
Tom
Super User Tom
Super User

If you cannot get the macro to work when you are typing the code then getting it to work when you are generating code via a data step is going to be impossible.

Tom
Super User Tom
Super User

Why are you running the data step if you are just going to push a sting literal to DOSUBL()?  

Run this code to see what you are asking DOSUBL() to run.

options mprint;
%finalload("tablename",contactdtpresent,externidpresent)

How many observations are in tables_toload?

What does the macro variable LOADCNT contain?  You seem to treating it as a boolean expression.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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
  • 6 replies
  • 486 views
  • 0 likes
  • 3 in conversation