Dear Statalists,
I tried to use Stata command grc1leg2 in Stata 15 to combine several graphs. I have three ways. Two work, but one doesn't. I wondered how to make method 2 works as it will help automate my code (in method 1 and 3, I need to change the code if I have more graphs to combine, but in method 2, if I succeed, I don't have to do that.)

Method 1 (works): the most simple way
Code:
grc1leg2  lnrevenue.gph lnvariety.gph lndestination.gph lnprice.gph qpct.gph , ///
 leg(qpct.gph) xtitle(qpct.gph )  xtob1 lsize(small)  graphregion(color(white)) title("Placebo",size(medium))
Method 2 (does NOT work): create a global variable
Code:
global sum ""
global vars "lnrevenue lnvariety lndestination lnprice   qpct "
foreach file of global vars{
local n "`file'.gph"
disp "`n'"
global sum "$sum" " "`n'""
 }
disp "$sum"
 *Stata returns:  lnrevenue.gph lnvariety.gph lndestination.gph lnprice.gph qpct.gph
 grc1leg2  "$sum", ///
 leg(qpct.gph) xtitle(qpct.gph )  xtob1 lsize(small)  graphregion(color(white)) title("Placebo",size(medium))
The error message is:
invalid syntax
r(198);

Method 3 (works): separate the global variables
Code:
global vars "lnrevenue lnvariety lndestination lnprice   qpct "
local i=1
foreach file of global vars{
global n`i' "`file'.gph"
*disp "$n`i'"
local i=`i'+1
 }
 grc1leg2  "$n1" "$n2" "$n3" "$n4" "$n5" , ///
 leg(qpct.gph) xtitle(qpct.gph )  xtob1 lsize(small)  graphregion(color(white)) title("Placebo",size(medium))
It seems that in method 2, Stata does not recognize the space which separates the variables. I wondered why method 2 won't work and how to make it work (if I can).
Thank you very much!
Best,
K