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 and date >= date'2021-04-01' then it runs between 2.5 and 3 seconds (resultset is approx 650k rows). If I add the and date >= 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.
I created a track. Number is
7613313278
Do i do something wrong? Can anybody please explain why?
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=&stf_case and date >= date'2021-04-01' group by wellbore, date, Plant_cd, Complex_cd, Facility_nm, bucket; quit;
That an interesting question.
Please format your code by pasting it using the appropriate icon.
Can you use
'01apr2021'd
instead of the typecast?
No, FEDSQL does not recognize that.
Next I would try to create a numeric literal:
%let cutoff=%sysfunc(inputn(2021-04-01,yymmdd10.));
and later
where stf_case=&stf_case
and date >= &cutoff
as I hope that dates in CAS are still counts of days from 1960-01-01.
Thanks, I thought about something like that. I used the numeric date but then I got another fault around comparing to integer.
@PaalNavestad wrote:
Thanks, I thought about something like that. I used the numeric date but then I got another fault around comparing to integer.
Please share the exact code you used.
Hi Kurt,
this is the code I used
%let stf_case = '2+10_21'; %let FcstStart= '01mar2021'd; data _null_; cutoff = &fcststart; call symput('cutoff',cutoff); run; This give
However when running this is FEDSQL
seleect etc.
from std_production.STF_all_details_hist
where stf_case=&stf_case
and date >= &cutoff
I get
So fedsql makes a difference between dates and numbers, something completely different from Base SAS.
Let's see what the TS track reveals.
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.
I suggest you open a Tech Support track on your findings and post the reply back here.
If you can't get an answer here, please contact SAS tech support.
And do let us know about the outcome. I am most curious.
Hi Chris, yes I will create a track
Hi all, this is now a verified bug with SAS and will according to SAS most probable be fixed in the next release.
Good on you for reporting it.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: