I am carrying out a study using panel data I would like t group the countries into regions, which I have been able to do using the following command:
generate region = 5
replace region = 1 if inlist(country, "Burundi", "Kenya", "Uganda", "Rwanda", "Mauritius")
replace region = 2 if inlist(country, "Burkino Faso", "Togo", "Mali", "Nigeria", "Mauritania", "Senegal")
replace region = 3 if inlist(country, "Egypt", "Sudan", "Morocco", "Tunisia", "Algeria")
replace region = 4 if inlist(country, "Eswatini", "Botswana", "Namibia", "Lesotho", "South Africa")
replace region = 5 if inlist(country, "Cameroon", "DR Congo", "Gabon")
Nevertheless, when I tabulated it using 'tab region', I realised that though the total value of the observations are correct, the values in each of the regions are not correct. How do I correct this?
Please note that the panel is unbalanced.
Thank you.
Related Posts with Grouping and Panel Data
Issues with inaccurate generate of a new variableHi there, I have recently used a very simple comand to generate a new variable. gen MFN_zero = Imp…
Difference-in-difference using tobit regression with mediation (controlling for fixed effects)Dear Statalist-users, I want to conduct a mediation analysis in a difference-in-difference setting.…
invalid syntax when referencing to variable labels in loopsI'm trying to refer to the labels of variables (to include these in graph titles) when looping on a …
How to export the freqs of multiple variables from stata to excelHello , I have been using tabout to output summaries for 2 X 2 tables quite well. Now a new need ha…
putting multiple graphs for quantitative vs categorical variables in one graphHi, I have 7 variables, which are actually for one survey question that asks respondents to rank th…
Subscribe to:
Post Comments (Atom)
0 Response to Grouping and Panel Data
Post a Comment