Use value label in if command

前端 未结 3 1585
猫巷女王i
猫巷女王i 2021-01-05 08:06

I am working with a set of dta files representing surveys from different years.

Conveniently, each year uses different values for the country

3条回答
  •  别那么骄傲
    2021-01-05 08:24

    Try

    replace country=1 if countryO=="Japan":country0valuelabel
    replace country=2 if inlist(countryO,"South Korea":country0valuelabel,"Korea":country0valuelabel)
    

    You will have to replace country0valuelabel with the corresponding value label name in your data. You can find out its name by looking at the penultimate column in the output of describe country0.

提交回复
热议问题