Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Comparing a sas calculated date to a date in a table

Posted on 2013-06-06
1
Medium Priority
?
553 Views
Last Modified: 2013-06-06
Experts,

I have a column in a table with a datea  stored as 05/01/2013
                                                                                     06/01/2013   etc.

I would like to compare the calculated date:

Dateb = date() - weekday(date()) + 1;   which is SAS format 19511

Is there a way to compare these two dates?
0
Comment
Question by:morinia
1 Comment
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 2000 total points
ID: 39227630
Dates in SAS is stored as a number field but can be formatted to be displayed in almost any possible combination e.g. MM/DD/YYYY, DD/MM/YYYY etc so even if it's showing as a nice looking human readable date, what's underlying is still a number offset from 01 Jan 1960..

therefore:
if DateA is already a date field, you can compare directly i.e. if DateA = DateB then

if DateA is not already a date field but a character field, you can use the input function to convert the character date to it's numerical equivalent i.e. input(DateA, MMDDYY10.) assuming the date string is in MM/DD/YYYY format, or input(DateA, DDMMYY10.) if the date string is in DD/MM/YYYY format before comparing to DateB as above
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

885 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