Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

SAS-between not working

Hi,
I am running below query getting no results but i can we have load_dte between
between 2012-01-23 and 2011-11-23 load_dte is numeric yymmdd10.

proc sql;
create table test1 as(
select count(*),LOAD_DTE from aa
where LOAD_DTE between 2012-01-23 and 2011-11-23
 );
quit;
0
sam2929
Asked:
sam2929
  • 3
1 Solution
 
theartfuldazzlerCommented:
Hi

The issue is that SAS is not recognizing the  dates as you are using them... Try change the code as follows: (note: EArlier date first)


select count(*),LOAD_DTE from aa where LOAD_DTE between
"23nov2011"d and 23jan2012"d ;
0
 
theartfuldazzlerCommented:
PS:
You may need a GROUP  statement:

select count(*),LOAD_DTE from aa where LOAD_DTE between
"23Nov2011"  and "23Jan2012"d
Group by LOAD_DTE;
0
 
theartfuldazzlerCommented:
Arghh, all the typos are killing me...

select count(*),LOAD_DTE from aa
 where LOAD_DTE between "23Nov2011"d and "23Jan2012"d
 Group by LOAD_DTE;
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now