I am currently using Stata 16.1 on Windows 10.
I'm trying to create a bar graph like attached below. However, I cannot seem to get the code right.
Variable Y is PD_12m, continuous
Variable ESG is on the X axes, grouped by industry ánd low/high percentiles.
The numbers on top of the bars are the averages of variable PD_12m, in industry x, in the low or high percentile (50/50) of ESG scores.
I have for example tried using a dummy for ESG lower percentile being 1:
However, the graph only depicts the mean per industry and not per "low" and "high" ESG percentile. Does anyone have a solution?

I'm trying to create a bar graph like attached below. However, I cannot seem to get the code right.
Variable Y is PD_12m, continuous
Variable ESG is on the X axes, grouped by industry ánd low/high percentiles.
The numbers on top of the bars are the averages of variable PD_12m, in industry x, in the low or high percentile (50/50) of ESG scores.
I have for example tried using a dummy for ESG lower percentile being 1:
Code:
gen byte dummy = ESG_score <= r(p50) graph bar (mean) PD_12m, over(i_id) over(dummy)
Comment