Hello,
Everyone,
I'm trying to find out a simple way to create a dummy variable in Stata. Normally, I just write this code: gen $a new variable name$=1 if($key indicator/variable$==&certain value&).
However, this time, I'm using a panel data model. I have 141 sample countries. The sample period is 14 years.
My research objective is to explore the determinants of inward foreign direct investment in China. One of the control variables is the economic association. I choose APEC and G-20 as dummy variables.
I need your advice on how to create a dummy variable if the country is a member of APEC and G-20. Is there any easy way to do it?
Currently, I only know the following way:
gen APEC=1 if(country==Australia|country==Canada| and so on)
replace APEC=0 if(country==I'm going to list all the non-APEC countries' name one by one).
However, I realize that this method will create too much work and may cause a few mistakes. Do you know any easy way to create a dummy variable in panel data model?
Thanks very much!
Everyone,
I'm trying to find out a simple way to create a dummy variable in Stata. Normally, I just write this code: gen $a new variable name$=1 if($key indicator/variable$==&certain value&).
However, this time, I'm using a panel data model. I have 141 sample countries. The sample period is 14 years.
My research objective is to explore the determinants of inward foreign direct investment in China. One of the control variables is the economic association. I choose APEC and G-20 as dummy variables.
I need your advice on how to create a dummy variable if the country is a member of APEC and G-20. Is there any easy way to do it?
Currently, I only know the following way:
gen APEC=1 if(country==Australia|country==Canada| and so on)
replace APEC=0 if(country==I'm going to list all the non-APEC countries' name one by one).
However, I realize that this method will create too much work and may cause a few mistakes. Do you know any easy way to create a dummy variable in panel data model?
Thanks very much!
Comment