BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

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!

 

6 REPLIES 6
Reeza
Super User

KISS - Keep it simple.

 

Use a line chart with two lines. 

 

ballardw
Super User

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.

Reeza
Super User

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;

 

GeorgeSAS
Lapis Lazuli | Level 10
Other than two lines, is there a better visual effect graph that can compare them in percentage?

Thanks!
Jay54
Meteorite | Level 14

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.

Reeza
Super User

@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. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1009 views
  • 4 likes
  • 4 in conversation