Syntax error in Proc SQL

Reply
Super Contributor
Posts: 275

Syntax error in Proc SQL

Hi,

One of my colleagues is getting a syntax error with proc sql. The code and the error is below -

substr(a.PROV_ID,(position('~' in A.PROV_ID )+1),3) as MBR_PCP_SITE

                                  79

                                  76

  ERROR 79-322: Expecting a SELECT.

ERROR 76-322: Syntax error, statement will be ignored.

Any suggestions would be appreciated. The DB engine is teradata.

Thanks,

saspert.

Trusted Advisor
Posts: 2,115

Re: Syntax error in Proc SQL

I don't think that you can use the "IN" operator from base SAS in PROC SQL; it gets confused with the "IN" condition from a SELECT statement.  You can probably reframe the position function using the INDEXC function to get around the problem.

Respected Advisor
Posts: 4,925

Re: Syntax error in Proc SQL

Replace position('~' in A.PROV_ID ) by findc(A.PROV_ID, '~').

PG

PG
Ask a Question
Discussion stats
  • 2 replies
  • 862 views
  • 0 likes
  • 3 in conversation