Single source of truth for era selection across the flag_* family and unite_records(). Returns "icd9" (1979-1998) or "icd10" (>= 1999) and errors on a 2-digit `datayear` (e.g. 93) or any 4-digit year before 1979, so an out-of-range year can never silently fall through into the wrong branch.