Problem Note 65487: An incorrect number of observations is returned after you use the DATEPART function in a WHERE statement for a CAS table
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
SAS System | SAS Viya | Linux for x64 | 3.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.
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.
Type: | Problem Note |
Priority: | medium |
Date Modified: | 2020-02-03 10:47:01 |
Date Created: | 2020-01-30 13:27:53 |