Recoding of categories based on multiple variables