Solved

SAS-between not working

Posted on 2012-03-13
3
342 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
  • 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 500 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

860 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