<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/322669#M71405</link>
    <description>Anybody help any further with this, its causing me some big problems</description>
    <pubDate>Thu, 05 Jan 2017 14:45:49 GMT</pubDate>
    <dc:creator>Stretlow</dc:creator>
    <dc:date>2017-01-05T14:45:49Z</dc:date>
    <item>
      <title>[Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316652#M69237</link>
      <description>&lt;P&gt;Morning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have had a new data warehouse introduced recently which I connect to via ODBC for some reason which i cant explain SAS isnt recognising the dates in a table as a date (all show as $10.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what ive been doing in order to extract data is a substring on the character so for example if i wanted the last three months i could write&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;substr(trandate,&lt;FONT color="#008000"&gt;1&lt;/FONT&gt;,&lt;FONT color="#008000"&gt;7&lt;/FONT&gt;) in (&lt;FONT color="#993366"&gt;"2016-11","2016-10","2016-09"&lt;/FONT&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this works fine on some tables but not others and i get the following message&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#993366"&gt;ERROR: CLI describe error: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt; invalid for argument 1 of SUBSTRING function. : [Microsoft][ODBC SQL Server Driver][SQL&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt; Server]Statement(s) could not be prepared.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;What is strange though is if i remove the substrring function and just search &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Trandate = "2016-11-30"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;it works fine....&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;I've done a little searching and while there are some discussions around the writing substrings on numeric variable this isnt the case here.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Any help greatly appreciated&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Using sas 9.3&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 11:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316652#M69237</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2016-12-05T11:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316661#M69241</link>
      <description>&lt;P&gt;On reason could be that SAS tries to push part of the query down to thwe DBMS.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and see how these two different SAS code translates to SQL Server SQL.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 11:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316661#M69241</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-12-05T11:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316676#M69247</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;On reason could be that SAS tries to push part of the query down to thwe DBMS.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and see how these two different SAS code translates to SQL Server SQL.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for respoinding. I've nver seen that before, Im assuming that just goes within the datastep?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if so this is what the log shows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;883&lt;BR /&gt;ODBC: AUTOCOMMIT is NO for connection 5&lt;BR /&gt;ODBC: AUTOCOMMIT turned ON for connection id 5&lt;/P&gt;
&lt;P&gt;ODBC_7: Prepared: on connection 5&lt;BR /&gt;SELECT * FROM "Integrity"."vwSalaryTransactions"&lt;/P&gt;
&lt;P&gt;884 data query;&lt;BR /&gt;885 set DWH2.vwTransactions;&lt;BR /&gt;886&lt;BR /&gt;887 Where substr(Trandate,1,7) = "2016-11";&lt;BR /&gt;888&lt;BR /&gt;889 options sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;BR /&gt;890&lt;BR /&gt;891 run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ODBC_8: Prepared: on connection 5&lt;BR /&gt;SELECT "AccountKey", "BankNumber", "AccountNumber", &amp;nbsp;"TranDate", "AgentUserID", "KnownAs", "TeamName", "FirstName", "Surname",&lt;BR /&gt;FROM "Integrity"."vwTransactions" WHERE ({fn SUBSTRING( "TranDate", 1, 7)}&lt;BR /&gt;= '2016-11' )&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ODBC_9: Executed: on connection 5&lt;BR /&gt;Prepared statement ODBC_8&lt;/P&gt;
&lt;P&gt;ERROR: CLI open cursor error: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date&lt;BR /&gt; is invalid for argument 1 of SUBSTRING function. : [Microsoft][ODBC SQL Server Driver][SQL&lt;BR /&gt; Server]Statement(s) could not be prepared.&lt;BR /&gt;NOTE: The DATA step has been abnormally terminated.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.QUERY may be incomplete. When this step was stopped there were 0&lt;BR /&gt; observations and 65 variables.&lt;BR /&gt;WARNING: Data set WORK.QUERY was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.32 seconds&lt;BR /&gt; cpu time 0.01 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 12:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316676#M69247</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2016-12-05T12:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316721#M69257</link>
      <description>&lt;P&gt;&lt;EM&gt;Options&lt;/EM&gt; is a global statement, and even if it works placing&amp;nbsp;in a data step, it's best practice to place them prior to the step that&amp;nbsp;will use.&lt;/P&gt;
&lt;P&gt;Can you also run the working where clause, so that we could compare?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that this behavior&amp;nbsp;is strange though, and perhaps it comes back to what datatype SAS use for this column. The best wold be to use date on "both sides".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 15:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316721#M69257</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-12-05T15:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316740#M69263</link>
      <description>&lt;P&gt;Hi... heres the logs 1st is the substr statement and the second is without.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1021&lt;BR /&gt;1022 options sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;BR /&gt;1023&lt;BR /&gt;ODBC: AUTOCOMMIT is NO for connection 5&lt;BR /&gt;ODBC: AUTOCOMMIT turned ON for connection id 5&lt;/P&gt;
&lt;P&gt;ODBC_19: Prepared: on connection 5&lt;BR /&gt;SELECT * FROM "Integrity"."vwSalaryTransactions"&lt;/P&gt;
&lt;P&gt;1024 data query;&lt;BR /&gt;1025 set DWH2.vwSalaryTransactions (keep = Trandate Accountkey Narrative1);&lt;BR /&gt;1026&lt;BR /&gt;1027 Where substr(Trandate,1,7) = "2016-11-30";&lt;BR /&gt;1028&lt;BR /&gt;1029 run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ODBC_20: Prepared: on connection 5&lt;BR /&gt;SELECT "AccountKey", "Narrative1", "TranDate" FROM "Integrity"."vwSalaryTransactions" WHERE ({fn&lt;BR /&gt;SUBSTRING( "TranDate", 1, 7)} = '2016-11-30' )&lt;/P&gt;
&lt;P&gt;ODBC: ROLLBACK performed on connection 5.&lt;BR /&gt;ERROR: CLI describe error: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is&lt;BR /&gt; invalid for argument 1 of SUBSTRING function. : [Microsoft][ODBC SQL Server Driver][SQL&lt;BR /&gt; Server]Statement(s) could not be prepared.&lt;BR /&gt;NOTE: The DATA step has been abnormally terminated.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.QUERY may be incomplete. When this step was stopped there were 0&lt;BR /&gt; observations and 3 variables.&lt;BR /&gt;WARNING: Data set WORK.QUERY was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.24 seconds&lt;BR /&gt; cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1030&lt;BR /&gt;1031 options sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;BR /&gt;1032&lt;BR /&gt;ODBC: AUTOCOMMIT is NO for connection 5&lt;BR /&gt;ODBC: AUTOCOMMIT turned ON for connection id 5&lt;/P&gt;
&lt;P&gt;ODBC_21: Prepared: on connection 5&lt;BR /&gt;SELECT * FROM "Integrity"."vwSalaryTransactions"&lt;/P&gt;
&lt;P&gt;1033 data query;&lt;BR /&gt;1034 set DWH2.vwSalaryTransactions (keep = Trandate Accountkey Narrative1);&lt;BR /&gt;1035&lt;BR /&gt;1036 Where Trandate = "2016-11-30";&lt;BR /&gt;1037&lt;BR /&gt;1038 run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ODBC_22: Prepared: on connection 5&lt;BR /&gt;SELECT "AccountKey", "Narrative1", "TranDate" FROM "Integrity"."vwSalaryTransactions" WHERE (&lt;BR /&gt;"TranDate" = '2016-11-30' )&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ODBC_23: Executed: on connection 5&lt;BR /&gt;Prepared statement ODBC_22&lt;/P&gt;
&lt;P&gt;NOTE: There were 104890 observations read from the data set DWH2.vwSalaryTransactions.&lt;BR /&gt; WHERE Trandate='2016-11-30';&lt;BR /&gt;NOTE: The data set WORK.QUERY has 104890 observations and 3 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 2.26 seconds&lt;BR /&gt; cpu time 0.21 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 15:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316740#M69263</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2016-12-05T15:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316855#M69298</link>
      <description>&lt;P&gt;I suggest trying:&lt;/P&gt;
&lt;PRE&gt;data query;
   set DWH2.vwSalaryTransactions (keep = Trandate Accountkey Narrative1 obs=10);
run;&lt;/PRE&gt;
&lt;P&gt;Which would pull 10 records from the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then run Proc Contents on Query.&lt;/P&gt;
&lt;P&gt;If the value is either a date or date time then the issue is with SUBSTR. Date values are going to be numeric and attempting to cast them to match a string value of &amp;nbsp;"2016-11-30" is likely to be the culprit.&lt;/P&gt;
&lt;P&gt;If the value is a datetime then you want to select using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where datepart(trandate) = '30NOV2016'd;&amp;nbsp; SAS will only recognize date literal values in the form of 'ddMONyy'd or 'ddMONyyyy'd (single or double quotes okay).&lt;/P&gt;
&lt;P&gt;If the value is a date then&lt;/P&gt;
&lt;P&gt;Where trandate = '30NOV2016'd;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 21:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316855#M69298</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-05T21:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316953#M69336</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I suggest trying:&lt;/P&gt;
&lt;PRE&gt;data query;
   set DWH2.vwSalaryTransactions (keep = Trandate Accountkey Narrative1 obs=10);
run;&lt;/PRE&gt;
&lt;P&gt;Which would pull 10 records from the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then run Proc Contents on Query.&lt;/P&gt;
&lt;P&gt;If the value is either a date or date time then the issue is with SUBSTR. Date values are going to be numeric and attempting to cast them to match a string value of &amp;nbsp;"2016-11-30" is likely to be the culprit.&lt;/P&gt;
&lt;P&gt;If the value is a datetime then you want to select using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where datepart(trandate) = '30NOV2016'd;&amp;nbsp; SAS will only recognize date literal values in the form of 'ddMONyy'd or 'ddMONyyyy'd (single or double quotes okay).&lt;/P&gt;
&lt;P&gt;If the value is a date then&lt;/P&gt;
&lt;P&gt;Where trandate = '30NOV2016'd;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HI there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its definately a character variable...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Contents: Variables" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="7" scope="colgroup"&gt;Alphabetic List of Variables and Attributes&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;#&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Variable&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Type&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Len&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Format&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Informat&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Label&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;AccountKey&lt;/TD&gt;
&lt;TD class="l data"&gt;Num&lt;/TD&gt;
&lt;TD class="r data"&gt;8&lt;/TD&gt;
&lt;TD class="l data"&gt;11.&lt;/TD&gt;
&lt;TD class="l data"&gt;11.&lt;/TD&gt;
&lt;TD class="l data"&gt;AccountKey&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;Narrative1&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;100&lt;/TD&gt;
&lt;TD class="l data"&gt;$100.&lt;/TD&gt;
&lt;TD class="l data"&gt;$100.&lt;/TD&gt;
&lt;TD class="l data"&gt;Narrative1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;TranDate&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;10&lt;/TD&gt;
&lt;TD class="l data"&gt;$10.&lt;/TD&gt;
&lt;TD class="l data"&gt;$10.&lt;/TD&gt;
&lt;TD class="l data"&gt;TranDate&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Dec 2016 08:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/316953#M69336</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2016-12-06T08:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/322669#M71405</link>
      <description>Anybody help any further with this, its causing me some big problems</description>
      <pubDate>Thu, 05 Jan 2017 14:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/322669#M71405</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2017-01-05T14:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/360649#M84961</link>
      <description>&lt;P&gt;Try to add an compress to the datefield.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;substr(trandate,&lt;/SPAN&gt;&lt;FONT color="#008000"&gt;1&lt;/FONT&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;FONT color="#008000"&gt;7&lt;/FONT&gt;&lt;SPAN&gt;) in (&lt;/SPAN&gt;&lt;FONT color="#993366"&gt;"2016-11","2016-10","2016-09"&lt;/FONT&gt;&lt;SPAN&gt;) ---&amp;gt;&amp;nbsp;substr(compress(trandate),&lt;FONT color="#008000"&gt;1&lt;/FONT&gt;,&lt;FONT color="#008000"&gt;7&lt;/FONT&gt;) in (&lt;FONT color="#993366"&gt;"2016-11","2016-10","2016-09"&lt;/FONT&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It look like the where claues is applied on the result from odbc and not passed to sql server.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 08:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/360649#M84961</guid>
      <dc:creator>GunnarTemnell</dc:creator>
      <dc:date>2017-05-23T08:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type date is invalid for argument 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/487115#M126873</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17829"&gt;@Stretlow&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This thread is very old and I doubt this is still an issue but this trick may help others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like the date fields may be defined inconsistently in your database tables. This would explain why it would work differently for various columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may help to take a look at them using SQL Server commands. Here is an example using everyone's favorite table - cars.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mssql sqlsvr complete="Driver={SAS ACCESS to SQL Server};
HOST='mysqlserver.mycompany.com';
UID=myuserid;PWD=mypassword;
DB=test"; 

data mssql.cars;
   set sashelp.cars;
run;

/*
  Use explicit pass-through to see how the columns are defined in the database.
*/

proc sql;
   connect using mssql;
   select * from connection to mssql
      (exec sp_columns cars);
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is the output...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sql_server_describe_table.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22468i0753BD6177E1BC10/image-size/large?v=v2&amp;amp;px=999" role="button" title="sql_server_describe_table.png" alt="sql_server_describe_table.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 18:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Microsoft-ODBC-SQL-Server-Driver-SQL-Server-Argument-data-type/m-p/487115#M126873</guid>
      <dc:creator>JBailey</dc:creator>
      <dc:date>2018-08-15T18:29:19Z</dc:date>
    </item>
  </channel>
</rss>

