Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SAS-between not working

Posted on 2012-03-13
3
Medium Priority
?
375 Views
Last Modified: 2012-06-27
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
Comment
Question by:sam2929
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 11

Expert Comment

by:theartfuldazzler
ID: 37716390
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
 
LVL 11

Expert Comment

by:theartfuldazzler
ID: 37716447
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
 
LVL 11

Accepted Solution

by:
theartfuldazzler earned 2000 total points
ID: 37716457
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question