Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Differences between dates

New Contributor
Posts: 4

Differences between dates


How do I get the difference in numbers between two dates?

I have tried using "Difference fro previous period", but It does not work with days?

Please look at Excel spreadsheet column "C"



Super User
Posts: 5,922

Re: Differences between dates

If you just want straight no of days just use minus.
Data never sleeps
Super User
Posts: 10,623

Re: Differences between dates

SAS stores dates as counts of days (from a given starting point, which is 1960-01-01). The difference in days between two dates can therefore be calculated with a simple subtraction.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
New Contributor
Posts: 4

Re: Differences between dates

Posted in reply to KurtBremser

I am very new to SAS va, could you show how?
Posts: 403

Re: Differences between dates

I have not got it to work in 7.4 but in 8.2 it works by using relative period and set offset to -1 and using "Inherit".

It works with days, but if you have a gap between the days you will get a missing value.


Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation