Relabel all variables according to a key word in stata. Help please.

Hello all,

I have a huge data set for which I need to change the labels for many of the variables.

At the moment the labels within a number of variables (but not all) state, for example:

Var name Q21 : var label = "In which state within Lebanon were you born"
Var name Q27: var label = "In which province in Lebanon do you live"
Var name Q43: var label = "How many friends in Lebanon do you have"
Var name migrate: label = "When did you migrate to Lebanon"

... and so on.

I would like to re use the dofiles from this data set on another data set from another country.

So I want to relabel all the 'Lebanon' words within the labels of the various variables for the entire data set, to be "[host country]".
But I need the remaining text within the labels to remain the same. That is I only want to change the word Lebanon to [host country].

(new var label = "In which state within [host country] were you born", "In which province in [host country] do you live", etc)

Is there a way I can do this without relabeling them all one by one?

it is confidential data so i cannot post better examples. I apologize.

Thanking you
Last edited: