Solved

SAS-between not working

Posted on 2012-03-13
3
307 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now