Desktop productivity for business analysts and programmers

Syntax error

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Syntax error

Hello I keep getting an error in my code (not sure what it is) Ive been trying everything but maybe I'm just not seeing it

My code is below followed by the error. Thank you!

     proc sql ;
       create table pharmacy_consults1  as
        select distinct
                       mbr_id
                      ,ACTV_STRT_DTTM
                      ,case when ACTV_TYP_ID in ('121') and RSLV_OTCOME_TYP_ID in ('369') then 1
                         else 0    end                       format=6.           as REFERRALS
                         ,CREATDT as ACTVCREATDT
                      from activities_mbr
                    where ((ACTV_STRT_DTTM is not null and ACTV_STRT_DTTM between "&beg_dt."d and "&end_dt."d) or
                           (ACTVCREATDT is not null  and ACTVCREATDT between "&beg_dt."d and "&end_dt."d)))
              group by mbr_id) ;
     quit ;

 


NOTE: Line generated by the invoked macro "CA_STEP2".
1024        "&end_dt."d) or                             (ACTVCREATDT is not null  and ACTVCREATDT
1024     ! between "&beg_dt."d and "&end_dt."d)))               group by mbr_id) ;      quit ;
                                                _                              _
                                                22                             79
                                                200
ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, *, **, +, -, /, <, <=, <>,
              =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT,
              HAVING, IN, INTERSECT, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ORDER,
              OUTER, UNION, ^, ^=, |, ||, ~, ~=. 

ERROR 79-322: Expecting a (.


Accepted Solutions
Solution
‎10-31-2017 07:32 AM
Super Contributor
Posts: 451

Re: Syntax error

SAS in 60 Seconds: In this episode, Neil Constable shows you how to find matching brackets in Base SAS and SAS Enterprise Guide. To find out more, join us on the SAS Expert Channel on http://www.sasprofessionals.net/group/expertchannel This material is similar to content covered in the SAS ...

All Replies
Super User
Posts: 20,236

Re: Syntax error

It’s an issue with the parenthesis. 

 

Remove all of your filters and add them back one by one until you see where the issue is. 

Respected Advisor
Posts: 4,976

Re: Syntax error

There should not be a closing parenthesis after the group by clause.

PG
Super User
Posts: 8,069

Re: Syntax error

And in your where condition you have three opening and four closing brackets.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎10-31-2017 07:32 AM
Super Contributor
Posts: 451

Re: Syntax error

SAS in 60 Seconds: In this episode, Neil Constable shows you how to find matching brackets in Base SAS and SAS Enterprise Guide. To find out more, join us on the SAS Expert Channel on http://www.sasprofessionals.net/group/expertchannel This material is similar to content covered in the SAS ...
☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 201 views
  • 2 likes
  • 5 in conversation