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;
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 ?
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;
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.
Here's the full documentation on attribute maps so you can specify exactly what you want.
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;
Dear Reeza:
I did not get any error msgs, but the output has no impact on the new attribute.
thanks for your help.
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 ?
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 ?
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
Do a PROC PRINT of your attrmap data set. You would get that error if the marker symbol name is invalid (misspelled or truncated).
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
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.