I am trying to produce graphs with different titles by using local macros to store the desired titles. However, I always get the "parentheses do not balance" message.

The following mwe shows what works and what doesn't:
Code:
sysuse auto, clear

local titles "Domestic" "Foreign"
local n_titles: word count `titles'

* This works: the words are shown
forvalues i=1/2{
    local x: word `i' of `titles'
    display "`x'"
}

* This does not work: parentheses do not balance
forvalues i=1/2{
    local x: word `i' of `titles'
    graph bar (median) price if foreign==`i'-1, title("`x'") over(make, label(nolabel))
}
Any hints on what I am missing?

Thanks in advance,

Vinicius