CDATE
The CDATE comparison function is used with the CDATE standardization and bucketing functions to facilitate the comparison of incomplete, partially valid, or approximate date ranges.
The CDATE comparison function is based on the overlap between the two date ranges being compared.
- Number of roles
- 1
- Number of dimensions
(in each role) - 1
- Weight table
- mpi_wgthead, mpi_wgt2dim
- The function uses a two-dimensional (2-dim) comparison function.
- The function substitutes 07 for a missing month and 14 for a missing day. The substitution is used to avoid incorrect matches with missed anonymous dates.
- If the dates are complete and exact, the dimensions are (1,1). If the dates ranges do not overlap, the dimensions are (15,15)
- If the date ranges overlap:
- Dimension 1 is based on how far apart the two dates are (diffDays).
- Dimension 2 is based on precision. The precision is defined by the lower of the two resolution values (implying a more precise date).
- The two-dimensional weight table indexes run from 0 to 15, in which (0, 0) signifies missing dates, (1, 1) signifies equal date ranges and (15, 15) signifies no overlap of date ranges. To handle overlapping dates, the precision and diffDays values must be quantized to fall between the 2-14 dimension range.
This table provides a feel for the indexes computed for the two dimensions given (diffDays and precision) in days.
Number of days | Index | Approximate number of years |
---|---|---|
1 | 2 | 1 |
78 | 3 | 1 |
278 | 4 | 1 |
529 | 5 | 2 |
846 | 6 | 2 |
1245 | 7 | 3 |
1747 | 8 | 4 |
2379 | 9 | 6 |
3174 | 10 | 8 |
4176 | 11 | 11 |
5437 | 12 | 14 |
7024 | 13 | 19 |
9022 | 14 | 24 |
11538 | 15 | 31 |