I have two variables, educgb1 and edubgb2 that measure the level of education of an individual as seen below. I will group these options into level of education e.g. secondary, tertiary and then I want to create a new ordered variable from lowest level of education to the highest.

However, my issue is when the individual answers both questions if they have a secondary qualification and tertiary education, I don't know how to create a variable that only uses the highest value. So in this case, if for educgb1 they have answered option 1 and for edubgb2 they have put option 2, then the new variable will use option 2.

This new variable will have ordered levels of education from 1 - 6 (lowest to highest), but I'm not sure how to create the new variable after grouping the options into level of education such that it only uses highest education level for each individual. Instead of, for example, adding the values from each variable together, like an index would.