sure, this is my loop:
foreach yvar in lefthipp_tbv righthipp_tbv leftamyg_tbv rightamyg_tbv {
graph box `yvar' ///
, over(female, relabel (1 "female" 2 "male") ///
label(labsize(large))) ///
over(groupnum, relabel (1 "AT" 2 "MDD" 3 "NCL") ///
label(labsize(vlarge))) ///
title("Figure XX", size(vlarge)) ///
ytitle("`yvar'", size(large) margin(small)) ///
graphregion(fcolor(white) lcolor(none)) ///
scheme(s2mono) ///
name(`yvar'_box, replace) ///
saving("`yvar'.graph", replace)
}
as you can see it would be nice to use the label of the variable rather than the variable name, both when creating the figure and saving a file. I also wrote "XX" for the Figure title too since I'm not sure how one can keep track of the loop # with this arrangement. I suppose you can declare a variable that starts at 1 at the beginning of the loop and increases by 1 at the end of the loop, but I just realized I don't even know how to do that! Generating a variable will create one that has the length of the # of observations I have so it seems easier if I just manually change things myself.
Any insight on this would be appreciated - thanks