I would like to see how many days (to the nearest 0.1) the following four observations are a part from each other (eg how many days are there between '11OCT2010:10:28:47' and '17OCT2010:12:21:47'?).
This variable x would show, for example, ., 2.0, 6.1, 10.2 .
I'm using datetime20. to format my datetime variable.
@Scott: Technically speaking, INTCK function is *not* appropriate for calculating the duration between two time points, especially the unit of time you use is larger than the accuracy of the time points you have. For example, I don't think it is appropriate to measure the duration between two datetimes (measured at the second unit) using a function call like INTCK('day',...). The reason being that the INTCK function enumerates the *boundaries* in the given interval. This means that in terms of 'DAY' interval (without any shifts), the INTCK counts how many midnights(00:00am) there are between the two given time points, which may be somewhat different from the counts of how many 24-hours between the two given time points.
In this case, OP is clear about what s/he wants -- the duration --, thus I would simple calculate it by subtracting the start from the finish (this will give the duration in terms of seconds). If the OP is asked to report it in other time units(minutes, hours, days), then a simple division/multiplication will do.
As many SAS programmers know, there are numerous ways to get to a desired result - I offered one that was somewhat generic to offer technical direction using available SAS functions / facilities.
From what I understood, the OP was interested in calculating "equivalent days between two datetime values", so my recommendation (one approach) was to take advantage of available SAS function INTCK -- here is an expression that will yield the correct result, using two SAS DATETIME variables (I have them coded as literals for over-simplification).