BookmarkSubscribeRSS Feed
Luth
Calcite | Level 5

I am a relatively new user of SAS EG, and I've run into a problem that I cannot find an answer to.  The data I'm querying against uses a field called "GROUP" that I need to pull into my query, but EG won't let me because it considers GROUP a keyword.  If I was using PC SAS, I know I could bracket [GROUP] and it would work, but I can't figure out how to get around this problem.  I'm getting a error stating Incorrect syntax near the keyword 'GROUP' whenever I attempt to use the GROUP field in my query.

I'm not the owner of the source data, so I cannot simply change the field name.  Any suggestions?

5 REPLIES 5
art297
Opal | Level 21

I am NOT an EG expert, but I had no problem, just now, including a variable called GROUP, in the query builder, as either a selection item, a group item or the target of a query.

Of course, if you do have a problem doing it, can't you just include code, before that, that opens the original file and makes a copy of it, renaming the variable?

Reeza
Super User

What's your version of EG?

And you can you post what the code/log displays.

Also, Tech Support may be faster.

Luth
Calcite | Level 5

I'm using version 4.1 - here is the code and log I'm getting back:

PROC SQL; CREATE TABLE SASUSER.Query_for_tblClaims_2012_Q3 AS SELECT tblClaims_2012_Q3.GROUP, (COUNT(tblClaims_2012_Q3.RXNUM)) AS COUNT_OF_RXNUM

FROM CLMSWHSE.tblClaims_2012_Q3 AS tblClaims_2012_Q3

WHERE tblClaims_2012_Q3.DOF = '15JUL2012'd AND tblClaims_2012_Q3.CLMSTAT = "P"

GROUP BY tblClaims_2012_Q3.GROUP;

QUIT;

ERROR: CLI prepare error: [DataDirect][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'GROUP'. :        [DataDirect][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. SQL statement: SELECT   GROUP ,  RXNUM ,  DOF ,  CLMSTAT   FROM  dbo . tblRxClaim_2012_Q3   WHERE  ( (  DOF  = {d '2012-07-15' } )        AND  (  CLMSTAT  = 'P' ) ). ERROR: PROC SQL runtime error for operation=sqxsrc. ERROR: An error has occurred.

art297
Opal | Level 21

I agree wth Fareeza .. this looks like one that would be most quickly addressed by tech support.  It appears to be a problem in what is being sent to SQL server.

Luth
Calcite | Level 5

Thank you for your advice - I'll take this one to tech support.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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