BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sueshaw
Obsidian | Level 7

proc gplot is easy to have plot and plot2 to create two y axes

 

I am using 9.3.

switch to use sgplot.  2 series used different color and symbols... can you force to use same color and symbols ?

I tried goptions colors=(...) and not help.

 

this is what I have

proc sgplot data=stat ;
series y=iron x=atptn /group=trt name='iron' lineattrs=(pattern=solid) markers ;
series y=fer x=atptn /y2axis group=trt name='fer' lineattrs=(pattern=dash) markers;
xaxis label='Hour';
yaxis label='Mean Y Concentration (µg/mL)';
y2axis label='Mean Y2 Concentration (ng/mL)'; 
keylegend 'iron' /title='Dose' noborder ;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
sueshaw
Obsidian | Level 7

in creating an example for you, I found out dattrmap solved the problem.

previously, I had a format for group variable...

once I remove format statement, and use raw data in attrmap and group, it worked.

this is great.... thank you...

 

another quick question... any ways to specify same symbol ? 

 

 

 

View solution in original post

10 REPLIES 10
Reeza
Super User
Which exact version of 9.3 are you using? You can check with the following code:

proc product_status;run;

There are several methods of doing this, I prefer data attribute maps because it's pretty straightforward and dynamic but there's also a STYLEATTRS statement that allows you to control the symbols/shapes/colours etc.

GOPTIONS do not apply to SG graphics.
sueshaw
Obsidian | Level 7

thank you so much.

 

for sas/graph, 9.3_M2

log file: SAS (r) Proprietary Software 9.3 (TS1M2)

 

I tried and got this msg, ERROR 180-322: Statement is not valid or it is used out of proper order.

maybe this option is not available on my version

 

proc sgplot data=stat ;
styleattrs datacolors=(red black blue green purple)
datasymbols=(circle square diamond triangle dot);
series y=iron x=atptn /group=trt name='iron' lineattrs=(pattern=solid) markers ;
series y=fer x=atptn /y2axis group=trt name='fer' lineattrs=(pattern=dash) markers;

 

Reeza
Super User

It looks like STYLEATTRS is not available for 9.3 M2, but it does look like data attribute maps are supported so that's good news. 

Here's an example of how to specify your different options. 

http://support.sas.com/documentation/cdl/en/grstatproc/65235/HTML/default/viewer.htm#n1sgstxp3pedkxn...

 

 

Here's the full documentation on attribute maps so you can specify exactly what you want. 

http://support.sas.com/documentation/cdl/en/grstatproc/65235/HTML/default/viewer.htm#p0teue0ztycuidn...

 

Hope that helps!

 


@sueshaw wrote:

thank you so much.

 

for sas/graph, 9.3_M2

log file: SAS (r) Proprietary Software 9.3 (TS1M2)

 

I tried and got this msg, ERROR 180-322: Statement is not valid or it is used out of proper order.

maybe this option is not available on my version

 

proc sgplot data=stat ;
styleattrs datacolors=(red black blue green purple)
datasymbols=(circle square diamond triangle dot);
series y=iron x=atptn /group=trt name='iron' lineattrs=(pattern=solid) markers ;
series y=fer x=atptn /y2axis group=trt name='fer' lineattrs=(pattern=dash) markers;

 


 

 

sueshaw
Obsidian | Level 7

Dear Reeza:

 

I did not get any error msgs, but the output has no impact on the new attribute.

 

thanks for your help.

Reeza
Super User
Show your code and output then.
sueshaw
Obsidian | Level 7

in creating an example for you, I found out dattrmap solved the problem.

previously, I had a format for group variable...

once I remove format statement, and use raw data in attrmap and group, it worked.

this is great.... thank you...

 

another quick question... any ways to specify same symbol ? 

 

 

 

Reeza
Super User

Same idea, add another column with the appropriate name and values and it will ensure the symbols are consistent. 

 


@sueshaw wrote:

in creating an example for you, I found out dattrmap solved the problem.

previously, I had a format for group variable...

once I remove format statement, and use raw data in attrmap and group, it worked.

this is great.... thank you...

 

another quick question... any ways to specify same symbol ? 

 

 

 


 

sueshaw
Obsidian | Level 7

I did not find document about symbol in SG attribute

 

I added a column of markersymbol to dataset attrmap,

got error msg 

ERROR 772-580: Syntax error: expecting a constant or a dynamic.

 

I will accept with the solution to specify the color for now.

 

thank you for all of your help

DanH_sas
SAS Super FREQ

Do a PROC PRINT of your attrmap data set. You would get that error if the marker symbol name is invalid (misspelled or truncated).

sueshaw
Obsidian | Level 7

this is amazing.

 

I need to increase length for markersymbol.

I also added markercolor.

now. the outcome is exactly what I am looking for.

I have attached the output fyi.

 

thanks all for the help

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 10 replies
  • 2519 views
  • 0 likes
  • 3 in conversation