BookmarkSubscribeRSS Feed
ren2010
Obsidian | Level 7
I have a date variable where dates are stored as mmddyyyy format,
how do i check the date variable using sql where condition?
Suppose i want to select all records whre date is greater than 01012009
what will be sql for this.
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest you search the forum archives - a popular post/topic/question. Also, how about the SAS support http://support.sas.com/ website with a suitable search there as well?

Scott Barry
SBBWorks, Inc.
venkatesh
Calcite | Level 5
proc sql;
select *from dataset name
where date ge '01012009'd ;
quit;
Cynthia_sas
Diamond | Level 26
Hi:
Please refer to the documentation on using constants in expressions:
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000780334.htm

Particularly, the use of date constants requires that the date constant be expressed in the form: ddMMMyy or ddMMMyyyy, as shown below:
[pre]
Use the following patterns to create date and time constants:

date='1jan2006'd;

date='01jan04'd;

[/pre]

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1266 views
  • 0 likes
  • 4 in conversation