Desktop productivity for business analysts and programmers

SAS Warning Message

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 120
Accepted Solution

SAS Warning Message

Hi ,

 

I am using

 

proc sql;

create table pp as

  select substr(cc,2,2) as yy,

       code

from bb

order by code ,cc

;

quit;

 

And i get below warning what should i do if i dont want to get this message . Can anyone help

 

NOTE: The query as specified involves ordering by an item that doesn't appear in its SELECT clause.
ODBC: AUTOCOMMIT is NO for connection 6
SAS_SQL:  Unable to convert the query to a DBMS specific SQL statement due to an error.
ACCESS ENGINE:  SQL statement was not passed to the DBMS, SAS will do the processing.
SAS_SQL:  Unable to convert the query to a DBMS specific SQL statement due to an error.
ACCESS ENGINE:  SQL statement was not passed to the DBMS, SAS will do the processing.
ODBC: AUTOCOMMIT turned ON for connection id 6


Accepted Solutions
Solution
‎06-13-2016 12:59 PM
Esteemed Advisor
Esteemed Advisor
Posts: 7,217

Re: SAS Warning Message

Order by operates on the end result of the statements - i.e. after the select anf from have operated, at which point the available columns are YY and CODE.

View solution in original post


All Replies
Esteemed Advisor
Posts: 5,198

Re: SAS Warning Message

It's pretty clear.
You have yy and code in your select clause, not cc.
Order by is for ouput, not input processing.
Data never sleeps
Esteemed Advisor
Esteemed Advisor
Posts: 7,217

Re: SAS Warning Message

Can you provide your full code, the error is telling you your code will be executed in SAS rather than in the database, which indicates at some point you are using a database - MS Access possibly.  MS Access does not support a substr function.

 

Also the note you get is because CC is not a variable in the select - it is used, but not selected.

Frequent Contributor
Posts: 120

Re: SAS Warning Message

Hi ,

So if i do

order by code ,yy then i dont get the error

 

but from table has cc variable in it

 

 

 

 

Thanks,

Solution
‎06-13-2016 12:59 PM
Esteemed Advisor
Esteemed Advisor
Posts: 7,217

Re: SAS Warning Message

Order by operates on the end result of the statements - i.e. after the select anf from have operated, at which point the available columns are YY and CODE.

☑ This topic is SOLVED.

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

Discussion stats
  • 4 replies
  • 430 views
  • 0 likes
  • 3 in conversation