Hi,
I am trying to draw a graph as shown below, I was wondering why the points at the same time point didn't consistent on the same vertical line?? for example, all points at x = -1 are not consistent on the vertical line x = -1, some a little left, some a little right...any idea?
Thanks,
here is my code:
ods graphics on / ATTRPRIORITY=NON width = 8in height = 6in border = off;
proc sgplot data= height_mean nowall noborder;
styleattrs datacontrastcolors=(blue red mediumgreen magenta orange lilac)
datasymbols=(circlefilled squarefilled trianglefilled triangleDownfilled DiamondFilled circle square)
datalinepatterns=(solid);
title height=.22in font ="Arial" 'Height cm';
series x=month y = mean_height /
group = patient groupdisplay=cluster clusterwidth=0.5
lineattrs=(thickness=3) markers markerattrs=(size=11);
xaxis label='Time (Months)' values = (-1 to 12 by 1) offsetmin=0.02
labelattrs = (Family=Arial size = 12 weight = bold) valueattrs = (Family=Arial size = 12 weight = bold);
yaxis label="Height cm" values = (50 to 80 by 5) labelattrs = (Family=Arial size = 12 weight = bold)
valueattrs = (Family=Arial size = 12 weight = bold) offsetmin=0;
keylegend / valueattrs=(Family=Arial size = 12 weight=bold) linelength=0.5cm position = right noborder title="";
run;
Here is the graph:
groupdisplay=cluster clusterwidth=0.5
Why do you have these options? That might be it. I don't think I have ever used them in a series plot.
Run PROC FREQ on your X variable and ensure that the values are all exactly MONTH=-1. I'll bet they are not.
Yes, they are. The month value was that I classified by event date in original data. Actually, as you can see, my previous questions you helped me solved, the points also didn't consistent in one vertical line. Any idea?
Thanks so much!
C
groupdisplay=cluster clusterwidth=0.5
Why do you have these options? That might be it. I don't think I have ever used them in a series plot.
Yes, I should remove these two statements.....
Thanks so much!!!
I agree with @WarrenKuhfeld, SAS doesn't jitter by default so it would have to be in the data.
Run a proc print on your data set and remove any formats to ensure you're seeing the underlying values, which is what SAS will be using. If you can, post the output from the following.
proc print data=height_mean;
var month;
format month;
where month < 0;
run;
Thanks, Reeza!! Both you and WarrenKuhfeld are correct!!!
C
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.