I would like to recode my variable named as Year
using a for
a loop and create a new variable named as year
in Stata.
What I am looking for should shorten below-mentioned code:
recode Year (5 = 1960) (6 = 1961)(7 = 1962)(8 = 1963)(9 = 1964) (10 = 1965) ///
(11 = 1966) (12 = 1967) (13 = 1968) (14 = 1969) (15 = 1970) (16 = 1971) ///
(17 = 1972) (18 = 1973) (19 = 1974) (20 = 1975) (21 = 1976) (22 = 1977) ///
, gen(year)