Desktop productivity for business analysts and programmers

GROUP Keyword issue

Reply
New Contributor
Posts: 3

GROUP Keyword issue

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?

Esteemed Advisor
Posts: 7,299

Re: GROUP Keyword issue

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?

Grand Advisor
Posts: 17,428

Re: GROUP Keyword issue

What's your version of EG?

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

Also, Tech Support may be faster.

New Contributor
Posts: 3

Re: GROUP Keyword issue

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.

Esteemed Advisor
Posts: 7,299

Re: GROUP Keyword issue

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.

New Contributor
Posts: 3

Re: GROUP Keyword issue

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

Ask a Question
Discussion stats
  • 5 replies
  • 481 views
  • 0 likes
  • 3 in conversation