Data visualization with SAS programming

points not on the same vertical line

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 84
Accepted Solution

points not on the same vertical line

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:

 

Height.png


Accepted Solutions
Solution
‎10-30-2017 03:28 PM
SAS Super FREQ
Posts: 496

Re: points not on the same vertical line

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. 

View solution in original post


All Replies
SAS Super FREQ
Posts: 496

Re: points not on the same vertical line

Run PROC FREQ on your X variable and ensure that the values are all exactly MONTH=-1.  I'll bet they are not.

Frequent Contributor
Posts: 84

Re: points not on the same vertical line

Posted in reply to WarrenKuhfeld

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

Solution
‎10-30-2017 03:28 PM
SAS Super FREQ
Posts: 496

Re: points not on the same vertical line

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. 

Frequent Contributor
Posts: 84

Re: points not on the same vertical line

Posted in reply to WarrenKuhfeld

Yes, I should remove these two statements.....

 

Thanks so much!!!

Super User
Posts: 22,845

Re: points not on the same vertical line

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;
Frequent Contributor
Posts: 84

Re: points not on the same vertical line

Thanks, Reeza!! Both you and WarrenKuhfeld are correct!!!

 

C

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 176 views
  • 0 likes
  • 3 in conversation