Hello everyone,

I currently have a categorical variable for education ( let's call it educ) which is divided into the following categories:

---------+-----------------------------------
Degree | 1,415 33.36 33.36
Other higher | 529 12.47 45.83
A level etc | 769 18.13 63.96
GCSE etc | 783 18.46 82.41
Other qual | 416 9.81 92.22
No qual

I am trying to turn this into years of schooling (educ_n), but I am struggling.


What I am trying to do is basically combine:
GCSE, other qual and no qual and turn them into 0<years of schooling<12
A level and other higher and turn them into 12=< years of schooling <13
Degree years of schooling>=13

My code is as follows so far:
generate educ_n=.

replace educ_n>0 & educ_n<=10 if educ==4&5&9

but it says > is an invalid command.

Could I please get some help?