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

x
?
Solved

Comparing a sas calculated date to a date in a table

Posted on 2013-06-06
1
Medium Priority
?
549 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
[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
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
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…
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…

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