Hello everyone;
I have the following dataset showing the evolution of the producer base price and the subsidy for two types of wheat (Durum Wheat and Soft Wheat) over the period 2020–2026:
I would like to create a stacked bar chart in Stata to illustrate the evolution of the producer base price and the subsidy for each type of wheat over the period 2020–2026. More specifically, I would like the graph to have the following characteristics:
Could anyone please suggest how to reshape my dataset, if necessary, and which Stata commands (particularly graph bar) I should use to produce this type of graph?
Thanks very much for the help!
I have the following dataset showing the evolution of the producer base price and the subsidy for two types of wheat (Durum Wheat and Soft Wheat) over the period 2020–2026:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int var1 str30 bldur str10 var3 str30 bltendre str10 var5 . "Prix ??de base à la production" "Subvention" "Prix ??de base à la production" "Subvention" 2020 "62" "20" "47" "12" 2021 "65" "22" "50" "17" 2022 "90" "40" "70" "30" 2023 "90" "50" "70" "40" 2024 "90" "50" "70" "40" 2025 "100" "40" "80" "30" 2026 "100" "40" "80" "30" end
- Two bars for each year, one representing Durum Wheat and the other representing Soft Wheat.
- Each bar should be divided into two segments with different colours:
- The first segment represents the producer base price.
- The second segment represents the subsidy.
- The two bars corresponding to each year should be grouped together, with the year displayed on the x-axis and the wheat type (Durum Wheat and Soft Wheat) identified above or below each bar.
- The y-axis should represent the values of the producer base price and the subsidy, expressed in Tunisian dinars per quintal (TND/quintal).
- A legend should distinguish between the producer base price and the subsidy.
Could anyone please suggest how to reshape my dataset, if necessary, and which Stata commands (particularly graph bar) I should use to produce this type of graph?
Thanks very much for the help!

Comment