BookmarkSubscribeRSS Feed
statsplank
Calcite | Level 5
Hello,

I'd appreciate it very much if somebody could help me with this.

I have the following data set "data1":

horiz vert x y

1 0.84501 0.1732 0.1732
2 0.77870 10.0000 10.0000
3 0.40234 . .
4 0.51641 . .
5 0.17316 . .
6 0.71898 . .
7 0.99211 . .
8 0.19475 . .
9 0.83093 . .
10 0.96780 . .


I would like to overlay a scatter plot and a line:

symbol1 v=none i=join;
symbol2 v=dot i=none;
proc gplot data=data1;
plot y*x vert*horiz /overlay skipmiss;
run;


... and I do get a line but no scatter plot. Instead, it seems the symbol1 definition continues to apply to vert*horiz as well.
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
The SYMBOL statement has a way of being used/re-used that is somewhat unique, as described here:
http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#symbolchap.htm Refer to the table in the section entitled, "Controlling Consecutive SYMBOL Statements" for an example of how you can have multiple SYMBOL statements, but SYMBOL2 will not be used until SYMBOL1 cycles through all the colors.


To have the most control over the SYMBOL statement one suggestion is :
1) explicitly use a COLOR= or C= option to cause each SYMBOL to only be used 1 time
and, in addition, you can specifically link a plot with a symbol by referring to the number of the nth generated SYMBOL definition in your plot request statement as described here: http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#gplot-plot.htm
and shown below.

cynthia
[pre]
symbol1 v=none i=join c=black;
symbol2 v=dot i=none c=blue;

proc gplot data=data1;
plot y*x=1 vert*horiz=2 /overlay skipmiss;
run;
quit;
[/pre]
statsplank
Calcite | Level 5
Cynthia, thank you for your detailed response!
MikeZdeb
Rhodochrosite | Level 12
hi ... Cynthia gave you several solutions to your problem and also explained how SAS cycles through the COLOR list for the ouput destination being used for each SYMBOL statement before moving onto the next SYMBOL statement

so when you write ...

symbol1 v=none i=join;

you are really writing MANY SYMBOL statemnts, one for each COLOR in the color list

another solution (if you don't mind using one color for all symbols) is to restrict the color list by using a GOPTIONS statement ... this will also work and give you two symbols in your plot ...

**************************************************
goptions reset=all csymbol=blue;

symbol1 v=none i=join;
symbol2 v=dot i=none;

proc gplot data=data1;
plot y*x vert*horiz /overlay skipmiss;
run;
quit;
**************************************************

if you want to see the color list associated with a specific device, try PROC GDEVICE ... for example, for a GIF file ...

* color list in OUTPUT window (with a LOT of other device attributes);
proc gdevice c=sashelp.devices nofs;
list gif;
quit;

if you are using SAS in display manager mode in Windows and produce graphics in the graphics output winow, you can see the default color list in two way ...

* color list in OUTPUT window;
proc gdevice c=sashelp.devices nofs;
list win;
quit;

* color list in the LOG and truncated list in the graphics output window;
proc gtestit;
run;

(you'll see a list of 38 colors in SAS 9.2)
statsplank
Calcite | Level 5
Thank you, Mike!

These are excellent points and I learned a lot of new things about the GOPTIONS and colour selection in SAS from your post!

Sincerely,
Olga

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1580 views
  • 0 likes
  • 3 in conversation