I am using levelsof to feed a list of ISO-3 country codes into wbopendata to query countries' GDP from the World Bank. wbopendata requires that the list of countries to be queried is in this format:

Code:
"ABW;AFG;ALB;ANT"
levelsof gives me an output like this:

Code:
`"ABW"';`"AFG"';`"ALB"';`"ANT"'
I use subinstr() to remove the quotes:

Code:
local countries = `"`"ABW"';`"AFG"';`"ALB"';`"ANT"'"'
di `"`countries'"'
local countries = subinstr(`"`countries'"', `"""', "", .)
di `"`countries'"'
I receive the following result:

Code:
. local countries = `"`"ABW"';`"AFG"';`"ALB"';`"ANT"'"'

. di `"`countries'"'
`"ABW"';`"AFG"';`"ALB"';`"ANT"'

. local countries = subinstr(`"`countries'"', `"""', "", .)

. di `"`countries'"'
;;;
which is not what I want. Am I having this issue because of all the compound quotes? I believe I am specifying correctly but clearly that is not the case.