SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 65487: An incorrect number of observations is returned after you use the DATEPART function in a WHERE statement for a CAS table

DetailsHotfixAboutRate It

Using the DATEPART function in a WHERE statement against a SAS® Cloud Analytic Services (CAS) table can return an incorrect number of observations. 

This issue happens only when the variable that is being passed to the DATEPART function contains missing values. 

The following syntax can illustrate the problem:

cas;
caslib _all_ assign;
data casuser.a;
   input x : datetime18.;
   datalines;
01jan2020:00:00:00
03jan2020:00:00:00
;
data casuser.b;
   set casuser.a;
   where datepart(x) ge '01jan2019'd;
run;

Instead of receiving all the observations that you expect, you receive only a portion of them in the results.

You can circumvent this issue by using a subsetting IF statement in place of the WHERE statement, as shown here:

data casuser.b;
   set casuser.a;
   if datepart(x) ge '01jan2019'd;
run;


Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemSAS ViyaLinux for x643.4
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.