BookmarkSubscribeRSS Feed
statsas
Fluorite | Level 6

Dears,

I'm using SAS 9.4.

I have a problem with jitter option in scatterplot statement within proc template.

I got a strange jittering for group "TRT A".

Bellow my SAS code and output.

 

Thanks in advance.

 

proc template;
   define statgraph plot1;
   begingraph;
      ENTRYTITLE  " Title"   ;


     layout datalattice COLUMNVAR=TRTSEQPN / columns=2 rows=1 headerlabeldisplay=value headerlabelattrs=(size=8pt)
            headerlabelattrs=GraphUnicodeText OUTERPAD=0.2 cm columngutter=8
     columnaxisopts=(display=(ticks tickvalues LABEL)  LABEL="xx" TICKVALUEATTRS= (family = "Arial" size = 7pt)
             type=discrete OFFSETMIN=0.15 OFFSETMAX=0.15) 
     rowaxisopts =(display=(ticks tickvalues LABEL) type=log 
            logopts=(BASE=2 Thresholdmax=1 Thresholdmin=1 MINORTICKS =TRUE MINORGRID=TRUE) 
            labelattrs=GraphUnicodeText labelattrs=(size=7pt) LABEL="y"  griddisplay=on )
     INSET=(nbc) insetopts=(autoalign=(topleft) CONTENTDISPLAY=VALUE DATASCHEME=Matched);
      layout prototype;
      SCATTERPLOT X=vis Y=aval/ group=TRTSEQPN MARKERATTRS=(size=8 ) jitter=auto JITTEROPTS=(width=0.50 );
  

      endlayout;


      endlayout;
   endgraph;
   end;
 quit;

proc format;
  value trtf 1="trt A"
             2="trt B";
Run;

proc sgrender data=im03 template=plot1 ; 
FORMAT  TRTSEQPN trtf. ;
run;

SGRender14.png

1 REPLY 1
ballardw
Super User

Since the markers are jittered then you will have to describe just what the actual "problem" is.

I suspect that you have an expected appearance but you don't say what that would be.

This from the documentation on the WIDTH option for JITTEROPTS may apply:

Note For a discrete axis, this option has effect only when the markers cannot be clustered side-by-side without overlapping. When WIDTH= is set to a value that is sufficient to eliminate marker overlap in that case, increasing the value further has no effect.

You have specified the x axis as discrete. If your issue is the odd vertical dispersion of markers I suspect the procedure is attempting to avoid overlapping the markers in both vertical and horizontal. Also o character has more area for overlapping than + so things move further apart to avoid the overlap.

 

And without any data we can't test your code for modification. From your display I would guess that Trt A has more records with similar Y values.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1 reply
  • 3126 views
  • 0 likes
  • 2 in conversation