I am making several boxplots comparing two groups on a variety of variables and would like to include the group averages in the graph labels. The code below is an example of how I'm doing this:
format hvar %10.0fc
summarize hvar if group == "A"
scalar group_a = round(`r(mean)', 1)
summarize hvar if group == "B"
scalar group_b = round(`r(mean)', 1)
graph box hvar, over(group, relabel(1 "Group A (Avg. = `=scalar(group_a)')" 2 "Group B (Avg. = `=scalar(group_b)')")) ytitle("HVAR")
I can't figure out how to get the scalars to display in the graph with commas. Any advice or suggestions on how to do this would be so helpful.
Thank you,
Erika
format hvar %10.0fc
summarize hvar if group == "A"
scalar group_a = round(`r(mean)', 1)
summarize hvar if group == "B"
scalar group_b = round(`r(mean)', 1)
graph box hvar, over(group, relabel(1 "Group A (Avg. = `=scalar(group_a)')" 2 "Group B (Avg. = `=scalar(group_b)')")) ytitle("HVAR")
I can't figure out how to get the scalars to display in the graph with commas. Any advice or suggestions on how to do this would be so helpful.
Thank you,
Erika
Comment