<?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: Why is FedSql ineffective with dates? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729977#M227245</link>
    <description>&lt;P&gt;Hi Chris, yes I will create a track&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 06:28:17 GMT</pubDate>
    <dc:creator>PaalNavestad</dc:creator>
    <dc:date>2021-03-30T06:28:17Z</dc:date>
    <item>
      <title>Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729709#M227146</link>
      <description>&lt;P&gt;Hi. I am working with FEDSQL and date. I have a table of approx. 40 million rows where I want to do the following. If I run this without the&amp;nbsp;and date &amp;gt;= date'2021-04-01' then it runs between 2.5 and 3 seconds (resultset is approx 650k rows). If I add the&amp;nbsp;and date &amp;gt;= date'2021-04-01' the same query runs in just over 25 seconds. giving a slightly smaller result set. If i run with out the date filter and does the subset for the in a separate sas data step the subsequent datastep runs in apprx. 0.4 seconds.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a track. Number is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif;"&gt;7613313278&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do i do something wrong? Can anybody please explain why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc fedsql sessref=casauto;
drop table casuser.WellProfileDays force;

create table casuser.WellProfileDays
as select

wellbore,
date,
Plant_cd,
Complex_cd,
Facility_nm,
bucket,
min(oil) as oil,
min(gas) as gas,
min(BOE) as boe
from std_production.STF_all_details_hist

where stf_case=&amp;amp;stf_case
and date &amp;gt;= date'2021-04-01'


group by
wellbore,
date,
Plant_cd,
Complex_cd,
Facility_nm,
bucket;

quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 07:32:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729709#M227146</guid>
      <dc:creator>PaalNavestad</dc:creator>
      <dc:date>2021-03-30T07:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729712#M227149</link>
      <description>&lt;P&gt;That an interesting question.&lt;/P&gt;
&lt;P&gt;Please format your code by pasting it using the appropriate icon.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 06:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729712#M227149</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-29T06:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729720#M227154</link>
      <description>&lt;P&gt;Can you use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'01apr2021'd&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of the typecast?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 08:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729720#M227154</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-29T08:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729722#M227156</link>
      <description>If it's just about the dates, FEDSQL, unlike PROC SQL, accepts all ANSI compliant datatypes, and therefore is processing all DOUBLE data type SAS dates against the FEDSQL date constant. It could be that SAS is converting the RHS equation date'2021-04-01' into DOUBLE data type to process each observation, and thereby pushing both CPU and Real time.</description>
      <pubDate>Mon, 29 Mar 2021 08:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729722#M227156</guid>
      <dc:creator>qoit</dc:creator>
      <dc:date>2021-03-29T08:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729732#M227158</link>
      <description>&lt;P&gt;No, FEDSQL does not recognize that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 08:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729732#M227158</guid>
      <dc:creator>PaalNavestad</dc:creator>
      <dc:date>2021-03-29T08:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729735#M227160</link>
      <description>&lt;P&gt;Thanks, I thought about something like that. I used the numeric date but then I got another fault around comparing to integer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 09:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729735#M227160</guid>
      <dc:creator>PaalNavestad</dc:creator>
      <dc:date>2021-03-29T09:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729739#M227163</link>
      <description>&lt;P&gt;Next I would try to create a numeric literal:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let cutoff=%sysfunc(inputn(2021-04-01,yymmdd10.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and later&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where stf_case=&amp;amp;stf_case
and date &amp;gt;= &amp;amp;cutoff&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;as I hope that dates in CAS are still counts of days from 1960-01-01.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 09:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729739#M227163</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-29T09:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729740#M227164</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/40011"&gt;@PaalNavestad&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks, I thought about something like that. I used the numeric date but then I got another fault around comparing to integer.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please share the exact code you used.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 09:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729740#M227164</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-29T09:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729867#M227207</link>
      <description>&lt;P&gt;Looks like you are using a CAS library in Viya - what version are you using? Viya is evolving rapidly so you might find later versions perform better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you open a Tech Support track on your findings and post the reply back here.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 20:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729867#M227207</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-29T20:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729937#M227224</link>
      <description>&lt;P&gt;If you can't get an answer here, please contact SAS tech support.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And do let us know about the outcome. I am most curious.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 04:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729937#M227224</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-30T04:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729976#M227244</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;this is the code I used&lt;/P&gt;&lt;PRE&gt;%let stf_case = '2+10_21';
%let FcstStart= '01mar2021'd;

data _null_;
	cutoff = &amp;amp;fcststart;
	call symput('cutoff',cutoff);
run;
This give&lt;/PRE&gt;&lt;DIV class="sasSource"&gt;%put cutoff=&amp;amp;cutoff;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;cutoff= 22340&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;However when running this is FEDSQL&lt;BR /&gt;&lt;BR /&gt;seleect etc.&lt;BR /&gt;&lt;BR /&gt;from std_production.STF_all_details_hist&lt;BR /&gt;&lt;BR /&gt;where stf_case=&amp;amp;stf_case&lt;BR /&gt;and date &amp;gt;= &amp;amp;cutoff&lt;BR /&gt;&lt;BR /&gt;I get &lt;/PRE&gt;&lt;DIV class="sasSource"&gt;WARNING: Unable to choose a best candidate operator. You might need to add explicit typecasts.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;ERROR: Operator is not unique: DATE &amp;gt;= INTEGER&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;ERROR: The action stopped due to errors.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: The FedSQL action was not successful&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;There is something in the syntax I do not understand.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;But the real challenge is why when entering dateconstants as the system expect it there is a much larger run time.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 Mar 2021 06:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729976#M227244</guid>
      <dc:creator>PaalNavestad</dc:creator>
      <dc:date>2021-03-30T06:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729977#M227245</link>
      <description>&lt;P&gt;Hi Chris, yes I will create a track&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 06:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729977#M227245</guid>
      <dc:creator>PaalNavestad</dc:creator>
      <dc:date>2021-03-30T06:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729985#M227253</link>
      <description>&lt;P&gt;So fedsql makes a difference between dates and numbers, something completely different from Base SAS.&lt;/P&gt;
&lt;P&gt;Let's see what the TS track reveals.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 07:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/729985#M227253</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-30T07:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/737182#M229787</link>
      <description>&lt;P&gt;Hi all, this is now a verified bug with SAS and will according to SAS most probable be fixed in the next release.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 07:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/737182#M229787</guid>
      <dc:creator>PaalNavestad</dc:creator>
      <dc:date>2021-04-27T07:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why is FedSql ineffective with dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/737190#M229794</link>
      <description>&lt;P&gt;Good on you for reporting it.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 08:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-FedSql-ineffective-with-dates/m-p/737190#M229794</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-27T08:38:52Z</dc:date>
    </item>
  </channel>
</rss>

