hi, I have dataset and I'm trying to get a plot from it. The dataset is something like below(not complete). Basically, the dataset I have contains 5 years of data and for each year, there are 12 months, and for each month, there are 3 types and each type has a spending. So one year has 36 rows. What I want for the plot is that the x-axis is the month of each year, the y-axis is the spending, but since there are three types, I also want separate lines for each type.
I'm trying to use proc sgplot, but I don't know how to make all five years spending show in one plot. I insert the plot I got from the code below. I know it is not correct since I intentionally make each type in both year gradually increase as month increases. In the final result, I only want the each year to show up instead of month like the photo I inserted.
Any suggestions would be very helpful. Thank you!
data have;
input year month type spending;
datalines;
2015 1 1 22
2015 1 2 33
2015 1 3 34
2015 2 1 23
2015 2 2 34
2015 2 3 35
2015 3 1 24
2015 3 2 35
2015 3 3 36
2015 4 1 25
2015 4 2 36
2015 4 3 37
2016 1 1 18
2016 1 2 30
2016 1 3 40
2016 2 1 19
2016 2 2 31
2016 2 3 41
2016 3 1 20
2016 3 2 32
2016 3 3 42
2016 4 1 21
2016 4 2 33
2016 4 3 43
;
run;
proc sgplot data=have;
series x=month y=spending / group=type;
run;