I'm new to Stata (about a week) and I want to rename variables in one dataset based on a metadata codelist stored in another dataset.
e.g. I have a dataset AGE as below:
a b c
GH 2 3
BH 2 5
and I have a metadata codelist META as below:
var var_decode
a initials
b age_years
c age_months
I want to replace the variable names a, b and c in AGE with the var_decodes from META
I think this is probably really simple but if somebody can give me a hand with the syntax or some example code it would be a big help
Thanks in advance.
e.g. I have a dataset AGE as below:
a b c
GH 2 3
BH 2 5
and I have a metadata codelist META as below:
var var_decode
a initials
b age_years
c age_months
I want to replace the variable names a, b and c in AGE with the var_decodes from META
I think this is probably really simple but if somebody can give me a hand with the syntax or some example code it would be a big help

Thanks in advance.
Comment