I'm getting the following error while I run the SAS code which query SQL table. It is worth to inform that the code which I ran contains put function to convert data field to character with yymmd8. Format. Is it OK to apply only the Options
options SQLMAPPUTTO=NONE to get rid of this error?
Please be informed that my SAS code contains multiple Proc SQL's in which few, query the SQL table and it contains PUT function. So I've to put only options SQLMAPPUTTO=NONE when it contains PUT function for SQL tables and for other query can I mention options SQLMAPPUTTO=SAS_PUT?
ERROR: Error during in-database processing.
ERROR: Error during in-database processing.
ERROR: ERROR: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Incorrect syntax near 'dbo'.
ERROR: ERROR: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]The batch could not be analyzed because of compile
errors.
ERROR: ERROR: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Incorrect syntax near 'dbo'.
ERROR: ERROR: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]The batch could not be analyzed because of compile
Can you please provide the full code?
If you use explicit pass-through, the code sent to the DB must use the DMBS's syntax.
It's a implicit passthrough.
Then I think we really need to see the code here.
Code is here @LinusH @Kurt_Bremser
proc sql;
create table work.OUTPUT as
select distinct
ID,
CAUSE,
(put(REPORTING_DATE ,yymmd8.)) as REPORTING_DATE length = 8
format = $8.
label = 'REPORTING_DATE'
from sqllbry.customer;
quit;
There's a "d" missing in your format name, and you should use yymmddn8. to avoid getting a 2-digit year.
still I'm getting the error after changing the Format to yymmddn8.
ERROR: Numeric format YYMMDDN in PUT function requires a numeric argument.
NOTE: A CASE expression has no ELSE clause. Cases not accounted for by the WHEN clauses will result in a missing value for the CASE
expression.
ERROR: Numeric format YYMMN in PUT function requires a numeric argument.
ERROR: Numeric format YYMMN in PUT function requires a numeric argument.
Which means that reporting_date is character, and not a date, at least as SAS sees it.
I also see no CASE clause in the code you posted, so we seem to be talking about different things here. For clear diagnosis, we need the code, the whole code, and nothing but the code. Please run your code with
options sastrace=',,,d' sastraceloc=saslog;
and post the whole log of the step.
Yes, what is the format of your reporting_date column?
You probably need to first do an input(reporting_date, whatever format your date column is in.)
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: