BookmarkSubscribeRSS Feed
imanojkumar1
Quartz | Level 8

Using the attached data, I am plotting the X, Y values w.r.t. Dates. I am using the following code:

 

proc sgplot  data=mydata;
series x=x y=y / group=Date break;
yaxis grid;
run;

And this is what plot looks like:

 

plot.png

 

Now question is...

 

in the above resulting plot I can not identify the 4 plots clearly.

 

Therefore, I want to do this:

  1. Between plots, can we add some common no. say something like 6 so that there occurs some visible difference.
  2. Thick lines with different colors (so that visually we can identify each)
5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

Please post test data as a datastep in the body of the post, attached xlsx files are a security risk.  With regards to your questions:

1)

What you talk about is jittering.  Here are some examples:

http://blogs.sas.com/content/graphicallyspeaking/2013/07/10/make-better-graphs-with-sas-9-4/

http://blogs.sas.com/content/iml/2011/07/05/jittering-to-prevent-overplotting-in-statistical-graphic...

You could also manipulate your data, i.e. each group gets +6 added to the result, more than the previous group.  Do this in a datastep before the sgplot.

 

2) 

To set the size of the lines, you use 

lineattrs=(thickness=X)

Where x is the width.

imanojkumar1
Quartz | Level 8
Hi RW9,
Thanks for raising the concerns. I can assure this file is virus checked before uploading.
Also, this data has some 5000 odds rows, so data step might not be a good option on this forum. And that's the reason why I had to upload the xlsx file (which is exported from SAS EG I work on).
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Its not concerns, its statutory company policy, and security sense for anyone.  If you need to post test data, do so as a datastep (to show structure) and only a few of the obsevations necessary to illustrate the problem.  You can do this by following this post:

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

Ksharp
Super User

proc sgpanel  data=mydata;
panelby date;
series x=x y=y /  break;
run;

imanojkumar1
Quartz | Level 8

Hi KSharp, Thanks for your suggestion. I already tried it. Unfortunately, this way the outcome is in 4 panels. But what I want that all the 4 plots in one panel, as in my question above, but where Date=6Jul16, the plot should be shifted up on Y-axis by 6000 in each row.
So where:
Date=6Jul16 and MeaNo=1,
the new_Y= -40075+6000 = -34075
Date=6Jul16 and MeaNo=2,
the new_Y= -39875+6000 = -33875
and so forth.
I am thinking, this way we can see some shift in the plot and difference between two dates (29Jun and 6Jul).

And I tried this..

 

PROC SQL;
 create table mydata as 
 SELECT *,
 CASE
 WHEN Date="06JUL2016"d THEN (y+6000)
 ELSE y
 END AS Y_Plus_6K
 FROM mydata;
QUIT;

proc sgplot  data=mydata1;
series x=x y=Y_Plus_6K / group=Date transparency=0.6 LINEATTRS=(thickness=2) break;
yaxis grid;
run;

 

But this looks horrible. May be you could suggest me something better.
Thanks once again.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1516 views
  • 2 likes
  • 3 in conversation