Hi all, thanks in advance for the help:
I am rather new to Stata, and I am completing my thesis.
I am trying to create a dummy variable out of a list of city names, with some cities being in the treatment group and some being control.
My first thought was to do the following:
gen Treatment=.
encode Municipality, gen(municipalityCoded)
replace Treatment=1 if municipalityCoded=="Montreal" *whatever the label name was Montreal for an example*
Then I figured I would do the same for the other cities (I am open to learning a way to do it for multiple cities at once) but it just doesn't work, telling me there is a type mismatch.
Any help would be extremely appreciated as I am a novice
I am rather new to Stata, and I am completing my thesis.
I am trying to create a dummy variable out of a list of city names, with some cities being in the treatment group and some being control.
My first thought was to do the following:
gen Treatment=.
encode Municipality, gen(municipalityCoded)
replace Treatment=1 if municipalityCoded=="Montreal" *whatever the label name was Montreal for an example*
Then I figured I would do the same for the other cities (I am open to learning a way to do it for multiple cities at once) but it just doesn't work, telling me there is a type mismatch.
Any help would be extremely appreciated as I am a novice

Comment