Link to home
Start Free TrialLog in
Avatar of sam2929
sam2929

asked on

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;
Avatar of theartfuldazzler
theartfuldazzler
Flag of South Africa image

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 ;
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;
ASKER CERTIFIED SOLUTION
Avatar of theartfuldazzler
theartfuldazzler
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial