I have data that has variables from the year 1960 to 1970 currently labeled as YR1960, YR1961, etc., but I want to make stata recognize them as dates and rename. So first i used the command: local i = 1960 , then after that I used the command: foreach var of varlist YR1960 YR1961 YR1962 YR1963 YR1964 YR1965 YR1966 YR1967 YR1968 YR1969 YR1970 {rename `var' yr_`i' local i = `i' + 1}
But i get the message "program error: code follows on the same line as open brace". What am i doing wrong?
But i get the message "program error: code follows on the same line as open brace". What am i doing wrong?
Comment