I have data with 160 countries and 6 sectors as variable names. I tried to use the foreach command to sum the six sectors of each country so I get 160 countries using
foreach var of varlist AFG1-ZWE6 {
egen `var'_FD = rowtotal (`var'*)
}
But this command just repeats the same variables and does not sum all the six sectors for each country. Could someone please help write the command well? Thanks in advance
foreach var of varlist AFG1-ZWE6 {
egen `var'_FD = rowtotal (`var'*)
}
But this command just repeats the same variables and does not sum all the six sectors for each country. Could someone please help write the command well? Thanks in advance
Comment