1) first label journal1-4 using the first columns (successful in my code (1))
2) then write a code to "copy" journalname1-journalname4 to the second variable list (or directly label the variables aboutjournal1-4 with the same labels)
| journal1 | journal2 | journal3 | journal4 | aboutjournal1 | aboutjournal2 | aboutjournal3 | aboutjournal4 |
| journalname1 | journalname2 | journalname3 | journalname4 | - | - | - | - |
| ... | ... | ... | ... | ... | ... | ... | .. |
Code:
unab varlist : journal1-journal4
foreach v of local varlist {
local value = `v'[1]
local vname = strtoname(`"`value'"')
rename `v' `vname'
label var `vname' `"`value'"'
}
0 Response to Label variable list (varlist) based on labels of another varlist
Post a Comment