We don't really know whether your variable is character or numeric. If it is character, consider the possibility of doing nothing. The values are already in sorted order. And they would be easy to subset: if "22M07" <= date <= "23M02"; Do you really want to create the situation where the value "32" changes its meaning depending on the data set that was used?
... View more