BookmarkSubscribeRSS Feed
saspert
Pyrite | Level 9

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.

2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12

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.

PGStats
Opal | Level 21

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

PG

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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