These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The graphics output in the Results tab was produced using SASĀ® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create input data set A */
data a;
input xvar yvar;
datalines;
1000 1
1000 1
1000 1
100 2
100 2
100 2
100 2
100 2
100 2
200 3
500 4
500 4
600 6
700 7
300 50
300 50
;
run;
/* Sort the data */
proc sort data=a out=sorted;
by xvar;
run;
/* Use PROC FREQ to find the number of */
/* duplicate X/Y values and create the */
/* output data set FREQDATA. */
proc freq data=sorted noprint;
tables xvar*yvar / out=freqdata;
run;
/* Use PROC MEANS to find the maximum X value. */
proc means data=sorted noprint;
var xvar;
output out=meansout(keep=max_x) max=max_x;
run;
/* Create a macro variable containing the maximum X value. */
data _null_;
set meansout;
call symput('max_x',max_x);
run;
/* Create the data set JITTER, which manipulates */
/* the horizontal values used for plotting. */
data jitter;
set freqdata;
pos_neg=1;
if count=1 then do;
x=xvar;
y=yvar;
output;
end;
if count > 1 then do;
x=xvar; y=yvar; output;
do i=1 to count-1 by 1;
if pos_neg=1 then x=xvar+(&max_x*0.015);
else x=xvar-(&max_x*0.015);
y=yvar;
output;
pos_neg=-1*pos_neg;
end;
end;
run;
/* Create axis definitions */
axis1 offset=(3,3)pct minor=none;
axis2 minor=none;
/* Create symbol definition */
symbol1 i=none v=dot c=vibg h=1;
/* Add a title to the graph */
title1 'Offset Identical X and Y Values';
footnote1 angle=90 ' ';
/* Create the graph */
proc gplot data=jitter;
plot y*x / haxis=axis1 vaxis=axis2 cframe=beige;
run;
quit;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GPLOT Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Symbols/Interpolation |
Date Modified: | 2005-08-31 03:03:18 |
Date Created: | 2004-11-11 11:08:01 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | All | n/a | n/a |