BookmarkSubscribeRSS Feed
Chetan302
Calcite | Level 5

I have scatter series plot using proc SGPLOT with different timepoints on each page.
Page having 5 timepoints on x axis have required gap between errorbars of two treatments with clusterwidth = 0.2 but other page having 8 timepoints have comparatively small gap between errorbars with same clusterwidth value.
Upon increasing clusterwidth value, I am getting required gap but along with gap, thickness of errobars also increased. I want to change only the gap without changing thickness. I have tried  errorbarattrs = (thickness = x) with and without transparence = x option but with use of these options clusterwidth = n seems not working. 
Any solution will be most welcome.

2 REPLIES 2
ballardw
Super User

Complete Sgplot code please. Plus data if possible, or modify your code to use a supplied data set like one of the SGPLOT examples.

 

 

Chetan302
Calcite | Level 5

Here is the sample code:-

proc sgplot data= &data DATTRMAP=Attrs  ;
  by paramn parameter;
  where paramn = &i ;
   styleattrs  datacontrastcolors = (red blue) datalinepatterns = (solid dash )  datasymbols = (circle plus)  ;
  
scatter x=visn y=&ymean / group=TRT01p ATTRID=TRT01p yerrorlower=&ylower yerrorupper=&yupper groupdisplay=cluster clusterwidth=0.2 name="s1" ;
 
series x=visn y=&ymean / group=TRT01p ATTRID=TRT01p lineattrs=(thickness=1 ) name="s2"  ; 
 
  xaxistable _N / x=visn class=trt01p location=inside  colorgroup=trt01p ATTRID=trt01p separator ; 
 
xaxis values = (0,30,180,210,360) valuesdisplay = ("Baseline" "Day 30" "Day 180" "Day 210" "Day 360")  valueattrs=(size=8) fitpolicy = rotate label="Visit" offsetmin = 0.045 offsetmax = 0.045 type = linear; 
 
%if &i = 1 %then %do; 
scatter x=visn y=&ymean / group=TRT01p ATTRID=TRT01p yerrorlower=&ylower yerrorupper=&yupper groupdisplay=cluster clusterwidth=0.35 name="s1" ; 
 
 xaxis values = (0,14,30,90,180,210,270,360)   valuesdisplay = ("Baseline" "Day 14" "Day 30" "Day 90" "Day 180" "Day 210" "Day 270" "Day 360")  valueattrs=(size=8) fitpolicy = rotate  label="Visit" offsetmin = 0.045 offsetmax = 0.045 type = linear; 
%end;     
  run;   

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
  • 2 replies
  • 370 views
  • 1 like
  • 2 in conversation