Hello everyone,
SAS can draw different kinds of graphics,I need your suggestion for what kind of SAS graph is the best for my project.
In my project, I need to compare two groups of data for 12 months,new_plan and old_plan
, the data values are production. new_plan has better value than old .I want to know how good in graphics by monthly.
Would you please give me advice on what kind of graph can best discript this comparasion?(value of new group is better in percentage than old.)
data compare; input month new_plan old_plan; cards; 1 131 115 2 130 114 3 129 113 4 128 112 5 126 110 6 125 109 7 124 108 8 122 107 9 121 106 10 120 104 11 118 103 12 117 102 ; run;
Thanks!
KISS - Keep it simple.
Use a line chart with two lines.
The data would likely work "best" as
Month Plan Value
1 New 131
1 Old 114
etc.
Then
Proc sgplot data=modifiedcompare;
series x=month y=value / group=plan;
run;
A Group variable allows the procedure to produce multiple lines with different colors and possibly line type depending on your current ods style and legend that will indicate, for example, the blue line represent New and the red line is Old plan data.
You can use multiple SERIES statement with the data in the current form.
Proc sgplot data=modifiedcompare;
series x=month y=old_value ;
series x=month y=new_value
run;
You can overlay two bar charts, one for New, one for Old. You can keep them coincident (reduce bar width for one of them), or put them side by side using DiscreteOffset. If you change data structure to "Grouped" like suggested by BallardW, you can use GROUP role. If the slope of change is important, it is better to use a series plot.
@GeorgeSAS wrote:
Other than two lines, is there a better visual effect graph that can compare them in percentage?
Thanks!
What does that mean?
Other plot suggestions are:
1. Plot the difference rather than the values
2. Plot it as a band, with the area between coloured to highlight the differences
3. Plot bars instead of line
All of these can be accomplished with SGPLOT.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.