<?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 SAS date parameter in pass through SQL statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208559#M38778</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a SAS date parameter that I am trying to figure out how to use in a pass through SQL statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Cur_month='30Apr2013'd ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ; &lt;/P&gt;&lt;P&gt;connect to SQLSVR as user1 (Server=Test Database=TestData );&lt;/P&gt;&lt;P&gt;Create table RawData as select * from connection to user1 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Select * From tblTest where ServiceDate &amp;gt;= &amp;amp;Cur_month and ODB_NO is not NULL) ;&lt;/P&gt;&lt;P&gt;quit; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above doesnt work because it will read in '30Apr2013'd which SQL server doesnt understand. &lt;/P&gt;&lt;P&gt;How would i be able to convert the above to '2013-04-30' so that SQL server run the query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Aug 2015 12:56:16 GMT</pubDate>
    <dc:creator>DangIT</dc:creator>
    <dc:date>2015-08-27T12:56:16Z</dc:date>
    <item>
      <title>SAS date parameter in pass through SQL statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208559#M38778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a SAS date parameter that I am trying to figure out how to use in a pass through SQL statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Cur_month='30Apr2013'd ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ; &lt;/P&gt;&lt;P&gt;connect to SQLSVR as user1 (Server=Test Database=TestData );&lt;/P&gt;&lt;P&gt;Create table RawData as select * from connection to user1 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Select * From tblTest where ServiceDate &amp;gt;= &amp;amp;Cur_month and ODB_NO is not NULL) ;&lt;/P&gt;&lt;P&gt;quit; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above doesnt work because it will read in '30Apr2013'd which SQL server doesnt understand. &lt;/P&gt;&lt;P&gt;How would i be able to convert the above to '2013-04-30' so that SQL server run the query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 12:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208559#M38778</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-08-27T12:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS date parameter in pass through SQL statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208560#M38779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you have a %let I see no problem using your preferred format.&lt;/P&gt;&lt;P&gt;If you this in an automated way jsut use data step function to convert the format (input - put using appropriate formats).&lt;/P&gt;&lt;P&gt;But, why use explicit pass through? I see nothing in the query that the libname access can't translate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208560#M38779</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-08-27T13:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS date parameter in pass through SQL statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208561#M38780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's a large amount of data i'm pulling through, so I believe pass through runs it much faster than if i were to use Libname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I took your approached and changed the %let Cur_Month='2013-04-30' and converted to dates in my other statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know how I could code a parameter from the Cur_month - 180 days? that i can feed through the pass through statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Cur_Month='2013-04-30'&lt;/P&gt;&lt;P&gt;proc sql ; &lt;/P&gt;&lt;P&gt;connect to SQLSVR as user1 (Server=Test Database=TestData );&lt;/P&gt;&lt;P&gt;Create table RawData as select * from connection to user1 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Select * From tblTest where&amp;nbsp; ServiceDate &amp;gt;= (&amp;amp;Cur_month-180) and ODB_NO is not NULL) ;&lt;/P&gt;&lt;P&gt;quit; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:26:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208561#M38780</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-08-27T13:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS date parameter in pass through SQL statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208562#M38781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Cur_month='30Apr2013'd;&lt;/P&gt;&lt;P&gt;%let sqlval = %sysfunc(putn(&amp;amp;Cur_month,yymmddd10.));&lt;/P&gt;&lt;P&gt;%put sqlval=&amp;amp;sqlval;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I believe the syntax for the date math would be:&lt;/P&gt;&lt;P&gt;dateadd(dd,-180,%str(%')&amp;amp;sqlval%str(%'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry..had to fix the sql syntax&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208562#M38781</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2015-08-27T13:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS date parameter in pass through SQL statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208563#M38782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you translate the syntax if i used %let Cur_Month='2013-04-30' rather than the SAS date format?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm having troubles with conversion especially with the single quotes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 14:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208563#M38782</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-08-27T14:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS date parameter in pass through SQL statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208564#M38783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got it to run with the following script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let LBDays=180;&lt;/P&gt;&lt;P&gt;%let Cur_month='30Apr2013'd;&lt;/P&gt;&lt;P&gt;%let sqlval = %sysfunc(putn(&amp;amp;Cur_month,yymmddd10.));&lt;/P&gt;&lt;P&gt;%put sqlval=&amp;amp;sqlval;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ; &lt;/P&gt;&lt;P&gt;connect to SQLSVR as user1 (Server=test Database=TestData );&lt;/P&gt;&lt;P&gt;Create table Raw_Data as select * from connection to user1 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Select * From tblTest where ServiceDate &amp;gt;= dateadd(dd,-&amp;amp;LBDays,%str(%')&amp;amp;sqlval%str(%')) and ServiceDate &amp;lt;= %str(%')&amp;amp;sqlval%str(%') and ODB_NO is not NULL) ;&lt;/P&gt;&lt;P&gt;quit; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 15:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208564#M38783</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-08-27T15:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS date parameter in pass through SQL statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208565#M38784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is another way to tackle the problem that slightly improves upon readability. I guess it is a matter of personal preference, but having a whole lot of %SYSFUNC() and %STR(%') statements might be a strain on one's eyes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calculating the lower date boundary up front (within SAS instead of invoking DATEADD in SQL Server), might improve performance by a small amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enjoy!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; LBDays=180;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; LBMonths=6;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; Cur_month='30Apr2013'd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: Consolas;"&gt;DATA&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;_NULL_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; dt_180_days_ago&amp;nbsp; = INTNX(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;'day'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;,&amp;nbsp;&amp;nbsp; &amp;amp;Cur_month, -&amp;amp;LBDays);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; dt_6mo_ago&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = INTNX(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;'month'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;, &amp;amp;Cur_month, -&amp;amp;LBMonths, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;'end'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;CALL&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; SYMPUTX(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"sqlval"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CATS(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;, PUT(&amp;amp;Cur_month,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: teal; background: white;"&gt;yymmddd10.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;CALL&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; SYMPUTX(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"sqlval_minus_180"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;, CATS(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;, PUT(dt_180_days_ago,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: teal; background: white;"&gt;yymmddd10.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: green; background: white;"&gt;/* a nice variant if you want 6 months ago instead ... */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;CALL&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; SYMPUTX(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"sqlval_minus_6mo"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;, CATS(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;, PUT(dt_6mo_ago,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: teal; background: white;"&gt;yymmddd10.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: Consolas;"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; &amp;amp;sqlval ... &amp;amp;sqlval_minus_180 ... &amp;amp;sqlval_minus_6mo;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: Consolas;"&gt;PROC&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: Consolas;"&gt;SQL&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;connect&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; sqlsvr &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; user1 (server=test database=testdata);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; raw_data &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; connection to user1 &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; tblTest &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; ServiceDate &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;BETWEEN&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; &amp;amp;sqlval &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; &amp;amp;sqlval_minus_180&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: green; background: white;"&gt;/* as an aside, and not in your original question, beware that MSSQL treats &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; empty strings and NULLs differently; so this may be more suitable ... */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: blue; background: white;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt; COALESCE(ODB_NO, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;) &amp;lt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: purple; background: white;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: Consolas;"&gt;QUIT&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 21:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-parameter-in-pass-through-SQL-statement/m-p/208565#M38784</guid>
      <dc:creator>hbi</dc:creator>
      <dc:date>2015-08-27T21:06:34Z</dc:date>
    </item>
  </channel>
</rss>

