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:
Now question is...
in the above resulting plot I can not identify the 4 plots clearly.
Therefore, I want to do this:
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/
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.
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:
proc sgpanel data=mydata; panelby date; series x=x y=y / break; run;
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.