<?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: Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90541#M19168</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FriedEgg nailed it.&amp;nbsp; SQL has no inherent ordering (not in SAS nor either version of SQL/Server), so &amp;amp;year is getting the last record that it decided to process that time.&amp;nbsp; That can vary with both the version of SQL and performance options that may have been set.&amp;nbsp; It can even change from run to run on the same data and SQL processor. The only way to force an order is to use the ORDER BY statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Apr 2012 17:33:09 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2012-04-20T17:33:09Z</dc:date>
    <item>
      <title>Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90538#M19165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;We are trying to connect to SQL server using ODBC from SAS 9.3 and getting unexpected results for the same.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;Here are a couple of examples --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; background: #d9d9d9; border: windowtext 1pt solid;" valign="top" width="347"&gt;&lt;P align="center"&gt;&lt;/P&gt;&lt;P align="center"&gt;&lt;/P&gt;&lt;P align="center" style="text-align: center;"&gt;SAS Codes Submitted (two examples below)&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #d9d9d9; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="312"&gt;&lt;P align="center" style="text-align: center;"&gt;Results Based upon Server Configuration used –&lt;/P&gt;&lt;P align="center" style="text-align: center;"&gt;32 bit server and windows 2003 OS&lt;/P&gt;&lt;P align="center" style="text-align: center;"&gt;SQL 2005 standard edition 32 bit&lt;/P&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG&gt;SAS 9.1 32-bit&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #d9d9d9; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="318"&gt;&lt;P align="center" style="text-align: center;"&gt;Results Based upon Server Configuration used –&lt;/P&gt;&lt;P align="center" style="text-align: center;"&gt;64 bit server and windows 2003 OS&lt;/P&gt;&lt;P align="center" style="text-align: center;"&gt;SQL 2005 Standard edition 64 bit&lt;/P&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG&gt;SAS 9.3 64-bit&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #c4bc96; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="347"&gt;&lt;P&gt;Proc&amp;nbsp; sql&amp;nbsp; noprint;&lt;/P&gt;&lt;P&gt;select&amp;nbsp; &lt;STRONG style="background: yellow;"&gt;distinct&lt;/STRONG&gt;&amp;nbsp; year(campaign_end_date) into: year from&amp;nbsp; SQL.campaign where campaign_id eq "014100094";&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put&amp;nbsp; &amp;amp;year.;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="312"&gt;&lt;P&gt;The output value we are getting in macro variable &lt;SPAN style="background: lime;"&gt;‘year’ is 2011.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="318"&gt;&lt;P&gt;The output value we are getting in macro variable &lt;SPAN style="background: yellow;"&gt;‘year’ is 1951.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #c4bc96; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="347"&gt;&lt;P&gt;Proc&amp;nbsp; sql&amp;nbsp; noprint;&lt;/P&gt;&lt;P&gt;Select&amp;nbsp; year(campaign_end_date) into: year2 from&amp;nbsp; SQL.campaign where campaign_id eq "014100094";&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;year2.;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="312"&gt;&lt;P&gt;The output value we are getting in macro variable &lt;SPAN style="background: lime;"&gt;‘year2’ is 2011.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="318"&gt;&lt;P&gt;“If we simply remove &lt;STRONG style="background: yellow;"&gt;‘distinct’&lt;/STRONG&gt; from the above query;“&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output value we are getting in macro variable &lt;SPAN style="background: lime;"&gt;‘year2’ is 2011.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: red; font-size: 12pt;"&gt;Is anyone aware of any nuances of connecting to SQL server using SAS 9.3 (64 bit) with the help of ODBC ?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 12:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90538#M19165</guid>
      <dc:creator>krithi</dc:creator>
      <dc:date>2012-04-20T12:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90539#M19166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your syntax the first rows value will be the value of the macro variable (both in 9.1 and 9.3) there must be something different with the ordering, in some way, observed between the two queries.&amp;nbsp; If you always want to retrieve the most recent year you should rewrite this query anyway to ensure the you get the date you are looking for using either MAX() function or an ORDER BY statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select year(min(campaign_end_date)), year(max(campaign_end_date))&lt;/P&gt;&lt;P&gt;into :min_year, max_year&lt;/P&gt;&lt;P&gt;from sql.campaign&lt;/P&gt;&lt;P&gt;where campaign_id eq "014100094";&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 16:02:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90539#M19166</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-04-20T16:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90540#M19167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If FriedEgg's theory is right, you should see multiple year values if you turn off the NOPRINT option.&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;FriedEgg wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;In your syntax the first rows value will be the value of the macro variable (both in 9.1 and 9.3) there must be something different with the ordering, in some way, observed between the two queries.&amp;nbsp; If you always want to retrieve the most recent year you should rewrite this query anyway to ensure the you get the date you are looking for using either MAX() function or an ORDER BY statement.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;/P&gt;
&lt;P&gt;select year(min(campaign_end_date)), year(max(campaign_end_date))&lt;/P&gt;
&lt;P&gt;into :min_year, max_year&lt;/P&gt;
&lt;P&gt;from sql.campaign&lt;/P&gt;
&lt;P&gt;where campaign_id eq "014100094";&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 16:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90540#M19167</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2012-04-20T16:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90541#M19168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FriedEgg nailed it.&amp;nbsp; SQL has no inherent ordering (not in SAS nor either version of SQL/Server), so &amp;amp;year is getting the last record that it decided to process that time.&amp;nbsp; That can vary with both the version of SQL and performance options that may have been set.&amp;nbsp; It can even change from run to run on the same data and SQL processor. The only way to force an order is to use the ORDER BY statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 17:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90541#M19168</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2012-04-20T17:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90542#M19169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your support and guidance. We were suggested "orderby" earlier too, but we missed a point here. We are using the data from a SQL table where there are only 6 observations which are all having the observations as 2011 and none of the observations is having 1951 as a value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your support.&lt;/P&gt;&lt;P&gt;puneet&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2012 04:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90542#M19169</guid>
      <dc:creator>puneet_gandhar</dc:creator>
      <dc:date>2012-04-23T04:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90543#M19170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please provide some additional information.&amp;nbsp; Particullary the table structure in SQL Server you are querying here.&amp;nbsp; Are you sure no updates to ODBC drivers were performed or alterations anywhere else beside updating your SAS version.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 00:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90543#M19170</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-04-27T00:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL code behavior difference when moved from SAS 9.1(32 bit) to SAS 9.3 (64 bit)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90544#M19171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add options &lt;EM&gt;sastrace&lt;/EM&gt;='d' &lt;EM&gt;sastraceloc&lt;/EM&gt;=&lt;EM&gt;saslog nostsuffix&lt;/EM&gt;; before your SQL code and then let us know how the SQL from the log which was actually sent to the server looks like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FriedEgg's ODBC drivers question: Good thought! Did you check that you're actually still connecting to the same database like before?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 01:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-code-behavior-difference-when-moved-from-SAS-9-1-32-bit/m-p/90544#M19171</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-04-27T01:18:55Z</dc:date>
    </item>
  </channel>
</rss>

