syntax error

Accepted Solution Solved
Reply
Contributor
Posts: 30
Accepted Solution

syntax error

Good day 

 

I keep getting this syntax error below - code is fine but it keeps throwing this error.

 

ERROR 22-322: Syntax error, expecting one of the following: ;, CHECK, CODEGEN, CONSTDATETIME, DOUBLE, DQUOTE, ERRORSTOP, EXEC,

              EXITCODE, FEEDBACK, FLOW, INOBS, IPASSTHRU, LOOPS, NOCHECK, NOCODEGEN, NOCONSTDATETIME, NODOUBLE, NOERRORSTOP,

              NOEXEC, NOFEEDBACK, NOFLOW, NOIPASSTHRU, NONUMBER, NOPRINT, NOPROMPT, NOREMERGE, NOSORTMSG, NOSTIMER, NOSTOPONTRUNC,

              NOTHREADS, NOWARNRECURS, NUMBER, OUTOBS, PRINT, PROMPT, REDUCEPUT, REDUCEPUTOBS, REDUCEPUTVALUES, REMERGE, SORTMSG,

              SORTSEQ, STIMER, STOPONTRUNC, THREADS, UBUFSIZE, UNDO_POLICY, WARNRECURS. 


Accepted Solutions
Solution
‎07-24-2017 08:15 AM
Contributor
Posts: 30

Re: syntax error

Posted in reply to KurtBremser

Thank you - running it now and I will revert back - will also look at the change history.

 

thank you very much 1

View solution in original post


All Replies
PROC Star
Posts: 761

Re: syntax error

Posted in reply to Allistair

Since you get an error, I suspect that your code is not fine Smiley Wink

 

Please show us your code.

Contributor
Posts: 30

Re: syntax error

Hi 

 

so I get the code could be the issue but it just started after being fine for many months:

 

code is :

 

 

 

%macro display_channel (channel);

 

data table.disp_daily_&channel.;

set table.disp_daily (where=(channel = "&channel."));

run;

 

proc sort data=table.disp_daily_&channel. nodupkey;

by co_cde LOAD_DATE COD_OFFER_TYPE CUST_NO ACCT_NO;

run;

 

proc sort data = table.disp_daily_&channel.;

                by   descending load_date;

run;

 

proc freq data=table.disp_daily_&channel. noprint;

tables co_cde*cod_offer_type*load_date /out=table.disp_daily_&channel.2;

run;

 

%datefill(&M1BDATE.,&TDATE.);

 

proc sort data=table.disp_daily_&channel.2 out=table.cod_offertypes nodupkey;

by co_cde cod_offer_type;

run;

 

proc sql;

     create table big3_daily2 as

     select     a.co_cde,

                a.cod_offer_type,

                b.load_date

     from

     table.cod_offertypes as a,

     big3_daily as b;

 

quit;

 

proc sql

     create table table.disp_daily_&channel.3 as

     select     a.co_cde,

                a.cod_offer_type,

                a.load_date,

                b.count

     from

     big3_daily2 as a

     left join

     table.disp_daily_&channel.2 as b

     on  a.cod_offer_type = b.cod_offer_type

     and a.load_date = b.load_date

    and a.co_cde = b.co_cde;

quit;

 

%offerinfo1               (table.disp_daily_&channel.3,table.disp_daily_&channel.4);

%offerinfo2               (table.disp_daily_&channel.4,table.disp_daily_&channel.4);

%month_of_load_date (table.disp_daily_&channel.4,table.disp_daily_&channel.4);

 

proc sort data=table.disp_daily_&channel.4;

by co_cde cod_offer_type month load_date;

run;

 

data table.disp_daily_&channel.5;

  set table.disp_daily_&channel.4;

  by co_cde

     cod_offer_type

     month;

  retain CUM_FREQ_ 0;

  if first.MONTH then CUM_FREQ_ = count;

  else CUM_FREQ_ = CUM_FREQ_ + count;

run;

 

proc sort data=table.disp_daily_&channel.5;

by co_cde prod load_date month day;

run;

 

proc means data=table.disp_daily_&channel.5 noprint;

by co_cde prod load_date month day;

var count;

output out=table.disp_daily_&channel.6 sum=;

run;

 

proc sort data=table.disp_daily_&channel.6;

by co_cde prod month load_date;

run;

 

data table.disp_daily_&channel.7;

  set table.disp_daily_&channel.6;

  by co_cde

     prod

     MONTH;

  retain CUM_FREQ_ 0;

  where prod ^= '';

  if first.MONTH then CUM_FREQ_ = count;

  else CUM_FREQ_ = CUM_FREQ_ + count;

run;

 

/*******************************************************/

 

/*Need to get unique displays PER CHANNEL for the table*/

 

/*******************************************************/

 

proc sort data=table.disp_daily_&channel.;

by co_cde LOAD_DATE CUST_NO ACCT_NO;

run;

 

proc sort data=table.disp_daily_&channel. nodupkey out=table.disp_un2_&channel.;

by co_cde TEMP_MONTH COD_OFFER_TYPE CUST_NO ACCT_NO;

run;

 

proc freq data=table.disp_un2_&channel. noprint;

tables co_cde*cod_offer_type*load_date /out=table.disp_un2_&channel.2;

run;

 

%datefill(&M1BDATE.,&TDATE.);

 

proc sort data=table.disp_un2_&channel.2 out=table.cod_offertypes nodupkey;

by co_cde cod_offer_type;

run;

 

proc sql;

     create table big3_daily2 as

     select     a.co_cde,

                a.cod_offer_type,

                b.load_date

     from

     table.cod_offertypes as a,

     big3_daily as b;

 

     create table table.disp_un2_&channel.3 as

     select     a.co_cde,

                a.cod_offer_type,

                a.load_date,

                b.count

     from

     big3_daily2 as a

     left join

     table.disp_un2_&channel.2 as b

     on  a.cod_offer_type = b.cod_offer_type

     and a.load_date = b.load_date

     and a.co_cde = b.co_cde;

quit;

 

%offerinfo1                (table.disp_un2_&channel.3,table.disp_un2_&channel.4);

%offerinfo2                (table.disp_un2_&channel.4,table.disp_un2_&channel.4);

%month_of_load_date (table.disp_un2_&channel.4,table.disp_un2_&channel.4);

 

proc sort data=table.disp_un2_&channel.4;

by co_cde cod_offer_type month load_date;

run;

 

data table.disp_un2_&channel.5;

  set table.disp_un2_&channel.4;

  by co_cde

     cod_offer_type

     month;

  retain CUM_FREQ_ 0;

  if first.MONTH then CUM_FREQ_ = count;

  else CUM_FREQ_ = CUM_FREQ_ + count;

run;

 

proc sort data=table.disp_un2_&channel.5;

by co_cde prod load_date month day;

run;

 

proc means data=table.disp_un2_&channel.5 noprint;

by co_cde prod load_date month day;

var count;

output out=table.disp_un2_&channel.6 sum=;

run;

 

proc sort data=table.disp_un2_&channel.6;

by co_cde prod month load_date;

run;

 

data table.disp_un2_&channel.7;

  set table.disp_un2_&channel.6;

  by co_cde

     prod

     MONTH;

  retain CUM_FREQ_ 0;

  where prod ^= '';

  if first.MONTH then CUM_FREQ_ = count;

  else CUM_FREQ_ = CUM_FREQ_ + count;

run;

%mend;

%display_channel (ONLINE);

%display_channel (ATM);

%display_channel (FUSION);

%display_channel (BRANCH);

%display_channel (MOBILE);

%display_channel (FNB_APP);

%display_channel (SELL_IT);

%display_channel (APEX);

 

Super User
Posts: 7,831

Re: syntax error

Posted in reply to Allistair

That's your culprit:

proc sql
     create table table.disp_daily_&channel.3 as

Missing semicolon after the proc sql statement.

@Tom caught it right from the start.

 

"so I get the code could be the issue but it just started after being fine for many months:"

 

So somebody changed it. Look at the change history in the code repository.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎07-24-2017 08:15 AM
Contributor
Posts: 30

Re: syntax error

Posted in reply to KurtBremser

Thank you - running it now and I will revert back - will also look at the change history.

 

thank you very much 1

Super User
Super User
Posts: 7,977

Re: syntax error

Posted in reply to Allistair

Please do not mark your own response as the answer to the question.  Select the person who provided the correct answer and mark that as the answer to the question, that way the answer appears under the question.

Contributor
Posts: 30

Re: syntax error

Posted in reply to KurtBremser

Hi 

 

that missing semi colon fixed the issue- thank you !

 

im not sure how my question got marked as the answer - aplogies but this is the answer that worked.

 

thanks

Super User
Posts: 7,831

Re: syntax error

Posted in reply to Allistair

A code cannot, by definition, be "fine" when it throws an ERROR.

 

Please post the log of the whole step that caused the ERROR message; use the 6th ({i}) or 7th ("little running man") icon to preserve formatting and special characters/character sequences.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,060

Re: syntax error

[ Edited ]
Posted in reply to Allistair

To debug an error message you need to look at the code that generated the error message. If you are using macros to generate the code then make sure to turn on the MPRINT option so that you can see the generated code in the log.

 

Because that list of valid options looks like the options on the PROC SQL statement most likely you have generate a PROC SQL statement without the ending semicolon.

133  proc sql
134   select
      ------
      22
      202
ERROR 22-322: Syntax error, expecting one of the following: ;, CHECK, CODEGEN, CONSTDATETIME, DOUBLE,
              DQUOTE, ERRORSTOP, EXEC, EXITCODE, FEEDBACK, FLOW, INOBS, IPASSTHRU, LOOPS, NOCHECK,
              NOCODEGEN, NOCONSTDATETIME, NODOUBLE, NOERRORSTOP, NOEXEC, NOFEEDBACK, NOFLOW,
              NOIPASSTHRU, NONUMBER, NOPRINT, NOPROMPT, NOREMERGE, NOSORTMSG, NOSTIMER,
              NOSTOPONTRUNC, NOTHREADS, NOWARNRECURS, NUMBER, OUTOBS, PRINT, PROMPT, REDUCEPUT,
              REDUCEPUTOBS, REDUCEPUTVALUES, REMERGE, SORTMSG, SORTSEQ, STIMER, STOPONTRUNC, THREADS,
              UBUFSIZE, UNDO_POLICY, WARNRECURS.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

 

Contributor
Posts: 30

Re: syntax error

Thank you !

☑ This topic is solved.

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

Discussion stats
  • 9 replies
  • 232 views
  • 4 likes
  • 5 in conversation