I am translating the following SPSS code into STATA. The SPSS code basically recodes 3 variables with different values into one variable.
SPSS code
My STATA code looks much more clunky.
Is there a more elegant way to do this in STATA?
Many thanks, Nina
SPSS code
Code:
RECODE BB72 (1=42) (2=35) (3=28) (4=21) (5=14) (6=7) INTO f_roespread . RECODE BB73 (1=5.5) (2=3.5) (3=1.5) INTO f_roespread . RECODE BB74 (1=0.75) (2=0.5) (3=0.25) (4=0) INTO f_roespread . EXECUTE.
Code:
recode BB72 (1=42) (2=35) (3=28) (4=21) (5=14) (6=7), gen(f_roespread) replace f_roespread=5.5 if BB73==1 replace f_roespread=3.5 if BB73==2 replace f_roespread=1.5 if BB73==3 replace f_roespread=0.75 if BB74==1 replace f_roespread=0.5 if BB74==2 replace f_roespread=0.25 if BB74==3 replace f_roespread=0 if BB74==4
Many thanks, Nina
Comment