One can add symbols in PROC GPLOT as follows.
data _;
do t=1 to 1000;
x+rannor(1);
y+rannor(1);
z+rannor(1);
output;
end;
run;
symbol1 i=join ci=blue v=dot cv=blue;
symbol2 i=join ci=red v=dot cv=red;
symbol3 i=join ci=lime v=dot cv=lime;
proc gplot;
plot (x y z)*t/overlay;
run;
And the following is the outcome.
But this is too dense if there are a lot of data points. Is it possible to add the symbols sparsely as follows?
For example, PAST WINNERS in the plot skips many observations and attaches the dots infrequently. Thanks in advance.
P.S. I wonder whether one can add something like the right-most dollar numbers in the sample plot to PROC GPLOT.
You could create another variable that is missing on most of the records from the existing value and assign a symbol that is only the marker, no interpolation
data _; do t=1 to 1000; x+rannor(1); y+rannor(1); z+rannor(1); /* set value for only a few values of the X*/ if mod(t,50)=0 then q=x; else q=.; output; end; run; symbol1 i=join ci=blue v=none cv=blue; symbol2 i=join ci=red v=none cv=red; symbol3 i=join ci=lime v=none cv=lime; symbol4 i=none c=blue v=dot ; proc gplot; plot (x y z q)*t/overlay; run;
And a similar plot with the newer SGPLOT
proc sgplot data=_; series x=t y=x/ lineattrs=(color=blue); series x=t y=y/ lineattrs=(color=red); series x=t y=z/ lineattrs=(color=lime); scatter x=t y=q/ markerattrs=(color=blue); run;
Note that axis labels are controlled differently. SGPLOT uses Xaxis and Yaxis statements and the syntax is different that the device based graphics AXIS statements though some items are similar. Also SGPLOT will add legends differently.
You could create another variable that is missing on most of the records from the existing value and assign a symbol that is only the marker, no interpolation
data _; do t=1 to 1000; x+rannor(1); y+rannor(1); z+rannor(1); /* set value for only a few values of the X*/ if mod(t,50)=0 then q=x; else q=.; output; end; run; symbol1 i=join ci=blue v=none cv=blue; symbol2 i=join ci=red v=none cv=red; symbol3 i=join ci=lime v=none cv=lime; symbol4 i=none c=blue v=dot ; proc gplot; plot (x y z q)*t/overlay; run;
And a similar plot with the newer SGPLOT
proc sgplot data=_; series x=t y=x/ lineattrs=(color=blue); series x=t y=y/ lineattrs=(color=red); series x=t y=z/ lineattrs=(color=lime); scatter x=t y=q/ markerattrs=(color=blue); run;
Note that axis labels are controlled differently. SGPLOT uses Xaxis and Yaxis statements and the syntax is different that the device based graphics AXIS statements though some items are similar. Also SGPLOT will add legends differently.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: