BookmarkSubscribeRSS Feed
David_Billa
Rhodochrosite | Level 12

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 

 

 

11 REPLIES 11
LinusH
Tourmaline | Level 20

Can you please provide the full code?

Data never sleeps
David_Billa
Rhodochrosite | Level 12
I can summarize the code for you as I left from office.

I'm querying the SQL server table via proc sql and that query has put
function (e.g. put(joining_date,yymmd8.) as joining_date for one variable.

Same code works fine if the contributing table is SAS dataset.
David_Billa
Rhodochrosite | Level 12

It's a implicit passthrough.

David_Billa
Rhodochrosite | Level 12

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;
David_Billa
Rhodochrosite | Level 12

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.
Kurt_Bremser
Super User

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.

LinusH
Tourmaline | Level 20

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.) 

Data never sleeps
David_Billa
Rhodochrosite | Level 12
Reporting_date field is numeric

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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