BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
echoli
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13
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

6 REPLIES 6
WarrenKuhfeld
Ammonite | Level 13

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

echoli
Obsidian | Level 7

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

WarrenKuhfeld
Ammonite | Level 13
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. 

echoli
Obsidian | Level 7

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

 

Thanks so much!!!

Reeza
Super User

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;
echoli
Obsidian | Level 7

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

 

C

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

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