Data visualization with SAS programming

How to assign different symbol to different line plot in proc sgpanel

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

How to assign different symbol to different line plot in proc sgpanel

I am trying to assign different symbols to each Temp but I couldn't find a means to do it.

I have 4 temp levels;

This is my code.

 

proc sgpanel data=EECreduced ;
panelby MC / spacing=5 novarname ;
vline day/ response= ECC group=Temp stat=mean markers limitstat=stddev markerattrs=(symbol=plus size=3) ;
run;

 

My thinking

from markerattrs= (symbols= plus..) (I should be able to add another code to pick the first temp for plus, second temp arrow down ..etc

I attached s sample plot fr your perusal

Thanks

 

 

Attachment

Accepted Solutions
Solution
‎04-17-2017 09:11 AM
Super User
Super User
Posts: 5,991

Re: How to assign different symbol to different line plot in proc sgpanel

[ Edited ]

I would suggest raising the issue with SAS Support team as the example in the blog post does not work for me using SAs 9.4.

Perhaps they changed something in 9.4?

If you run this code the same symbol is used for both lines which looks like the issue you are seeing.

proc sgplot data= sashelp.class;
  title 'Using the STYLEATTRS statement in SAS 9.4';
  styleattrs 
   datacontrastcolors=(orange purple)
   datalinepatterns=(1) 
   datasymbols=(circlefilled trianglefilled)
  ;
  reg x=weight y=height / group=sex degree=3;
run;

But the SAS log has a note about using the ATTRPRIORITY setting.

So adding this line before the PROC SGPLOT makes it work.

ods graphics / attrpriority=none;

 

View solution in original post


All Replies
Grand Advisor
Posts: 16,419

Re: How to assign different symbol to different line plot in proc sgpanel

New Contributor
Posts: 2

Re: How to assign different symbol to different line plot in proc sgpanel

Thank you so much for your very helpful response. I appreciate it so much!!.

 

I am using sas studio online at home and sas 9.4 in school.

 

My response is based on the sas studio online

I modified the code as follows

proc sgpanel data=EECreduced ;
styleattrs datacontrastcolors=(orange black green red) datalinepatterns=(1)
datasymbols=(circlefilled trianglefilled rectanglefilled sqaurefilled);
panelby MC / spacing=5 novarname ;
vline day/ response= ECC group=Temp stat=mean markers limitstat=stddev ;
run;

Summary

The colour of each line changed but the symbols remain.

Please see attached 

Thank you

Attachment
Solution
‎04-17-2017 09:11 AM
Super User
Super User
Posts: 5,991

Re: How to assign different symbol to different line plot in proc sgpanel

[ Edited ]

I would suggest raising the issue with SAS Support team as the example in the blog post does not work for me using SAs 9.4.

Perhaps they changed something in 9.4?

If you run this code the same symbol is used for both lines which looks like the issue you are seeing.

proc sgplot data= sashelp.class;
  title 'Using the STYLEATTRS statement in SAS 9.4';
  styleattrs 
   datacontrastcolors=(orange purple)
   datalinepatterns=(1) 
   datasymbols=(circlefilled trianglefilled)
  ;
  reg x=weight y=height / group=sex degree=3;
run;

But the SAS log has a note about using the ATTRPRIORITY setting.

So adding this line before the PROC SGPLOT makes it work.

ods graphics / attrpriority=none;

 

Post a Question
Discussion Stats
  • 3 replies
  • 100 views
  • 1 like
  • 3 in conversation