Hi all sas experts,
I have quick question about scatterplot with jitter. if the input data are same, the scatter plot with jitter's sas code is also same, the output plot shall be exacatly same (each point position exactly same position) when I run this code different times. correct?
Thanks,
Lee
A quick test (on my old version) shows that the randomisation algorithm is constant.
ods graphics on / width=320px height=200px;
data IRIS; set SASHELP.IRIS; where PETALLENGTH < 20;
proc sgplot data=IRIS; scatter x=PETALLENGTH y=PETALWIDTH/ jitter;
proc sgplot data=IRIS; scatter x=PETALLENGTH y=PETALWIDTH/ jitter;
proc sgplot data=IRIS; scatter x=PETALLENGTH y=PETALWIDTH/ jitter;
proc sgplot data=IRIS; scatter x=PETALLENGTH y=PETALWIDTH /jitter;
proc sgplot data=IRIS; scatter x=PETALLENGTH y=PETALWIDTH/ jitter;
run;
Is the picture visible below?
I believe that is correct. You can use ODS OUTPUT to save the underlying data to a SAS data set, then use PROC COMPARE to show that the values are the same:
data IRIS; set SASHELP.IRIS; where PETALLENGTH < 20;
run;
ods output sgplot =sg1;
proc sgplot data=IRIS;
scatter x=PETALLENGTH y=PETALWIDTH/ jitter jitterwidth=1;
xaxis grid;
yaxis grid;
run;
/* wait 3 seconds, just in case the seed is based on the time */
data _null_;
call sleep(3000);
run;
ods output sgplot =sg2;
proc sgplot data=IRIS;
scatter x=PETALLENGTH y=PETALWIDTH/ jitter jitterwidth=1;
xaxis grid;
yaxis grid;
run;
proc compare base=sg1 compare=sg2;
run;
/* RESULT: No unequal values were found. All values compared are exactly
equal. */
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!
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.
Ready to level-up your skills? Choose your own adventure.