Hi,
I'm trying to merge data from a yearly questionnaire to form a panel.
The date follows the following format:
Meanwhile, the questions' name follow the follow pattern:
So far, I've tried this:
It successfully renames everything into date but the second tsunab, " tsunab q : c*(###)", returns "# invalid name". I've tried basically every iteration with wildcards I can think of, to no avail. I always get an invalid name or an unfound variable (e.g., c).
Thank!
I'm trying to merge data from a yearly questionnaire to form a panel.
The date follows the following format:
- cp08a_m
- cp09b_m
- cp10c_m
Meanwhile, the questions' name follow the follow pattern:
- cp08a001
- cp08a002
- cp09b001
- cp09b002
So far, I've tried this:
Code:
forval n = 1/10 {
use "$path\Originales\Personality`n'.dta", clear
tsunab year : c*_m
rename `year' date
replace date = 2007+`n'
tsunab q : c*(###)
rename `q' P(###)
save "$path\Modifiees\Personality`n'_m.dta", replace
clear
}
Thank!

Comment