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: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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