DATE (comparison functions)
The DATE function is used to compare two dates.
- Number of roles
- Number of dimensions
(in each role)
- Weight table
- mpi_wgtnval, mpi_wgthead, mpi_wgt1dim
- If the lengths of the two strings are eight characters, then the year is extracted from both strings and the years are compared. If the years are equal, then the month and day are extracted and compared. If they are all equal, then the weight is computed by adding the weight for index1 from mpi_wgt1dim to the weight for this particular year from mpi_wgtnval table. If the strings are less than or greater than eight characters, they are treated as ANON.
- If the dates match exactly, or the edit-distance is zero, then the weight is a combination of two tables—mpi_wgtnval and mpi_wgt1dim table.
- If they do not match exactly, the corresponding edit-distance value is used as a lookup in the mpi_wgt1dim table. Here the mpi_wgtnval table is not used. If the dates of one string match with the month of the other string and vice versa, it is a transposed match and the distance is treated as one.
1978-24-03 and 1978-24-03 have an exact match. Therefore, the weight will be the weight for index 1 in mpi_wgt1dim + weight for 1978 in the mpi_wgtnval table.
1978-24-03 and 1978-03-24 will have a single transposition and an edit distance of 1. Thus, the weight will be the weight for index 2 in the mpi_wgt1dim table.
1978-24-03 and 1979-24-03 have an edit-distance of 1 and the weight is the weight that corresponds to index 2 in mpi_wgt1dim.
The following are examples of the weight tables expected.
1|1|A|CMPID-DOB-DIST|0|0| 1|1|A|CMPID-DOB-DIST|1|0| 1|1|A|CMPID-DOB-DIST|2|182| 1|1|A|CMPID-DOB-DIST|3|18| 1|1|A|CMPID-DOB-DIST|4|-190|