BookmarkSubscribeRSS Feed
LB
Quartz | Level 8 LB
Quartz | Level 8

Hello all;

IS there a way to only set the graph elements for the first graph data element

So for example;

I have

style Graphdata1 /Color=black line ;

style Graphdata1 /contrastColor=black linethickness=3 ; 

I want only one facility to stand out in terms of having a black line that is thicker and larger markers than the rest of them.  

Many Thanks.

Lawrence

8 REPLIES 8
Reeza
Super User

Yes, but how depends on what version of SAS you are on.

So, which version are you on?

LB
Quartz | Level 8 LB
Quartz | Level 8

Reeza;

Good point-SAS 9.2. I am using indexes. The first index, coordinates graph data element 1. The rest I don't care about per se in terms of color.

Lawrence

Jay54
Meteorite | Level 14

You can set line thickness or marker size in the GraphData elements, but these will not be honored in group case.  The color and pattern come from the GraphData elemtn, but thickness comes from the GraphDataDefault element.  The reason was to provide equal weight to all group values.  To draw one series with a different thickness, you will have to separate it out from the others and draw it with thicker line thickness in the LINEATTRS option.

This works the same way in Attribute Map too.  There have been requests for this feature so this may be added at a future release.

LB
Quartz | Level 8 LB
Quartz | Level 8

Thanks Sanjay.

Anyway some conditional logic might work?

Also, is there a way to stop the colors from repeating in a pattern? What I see is that it goes for about 12 different colors, then the whole series repeats itself-

So it might be red, black, green...then back again.

Thanks

Lawrence

Jay54
Meteorite | Level 14

With SAS 9.2, colors and patterns (or symbols) cycle through the lists for each group.  So, first group value gets first color and first pattern, second group gets second color and second patter, and so on till you run out of the 11 patterns.  Then, group #12 gets 12th color and 1st pattern, and it continues..

If you want more colors, define more GraphData elements beyond 12 without any gaps in the color value.  If instead you want to hold the color constant, that is easy, just specify the color in the LINEATTRS option.

LB
Quartz | Level 8 LB
Quartz | Level 8

Sanjay;

Thanks.

I tried defining the color after #12, but it seems to not take effect anymore-Are there limits on the number of graphing elements I can choose?

Lawrence

Jay54
Meteorite | Level 14

Here is a SAS 9.2 example.  Note Green and Black color needles and scatter markers for last two names.

Note: ContrastColor is used for the markers, Color is used for bars.

proc template;                                                               
   define style Styles.Thirteen;                                             
      parent = styles.listing;
      style GraphData13 /                                     
         markersymbol="circlefilled"
         linestyle=1
         color=red contrastcolor=green;
      style GraphData14 /                                     
         markersymbol="circlefilled"
         linestyle=1
         color=gray contrastcolor=black;
   end;
run;


ods listing style=thirteen;
ods graphics / reset width=6in height=3in imagename='Thirteen';
proc sgplot data=sashelp.class(obs=14);
  needle x=name y=height / group=name lineattrs=(pattern=solid thickness=9);
  scatter x=name y=height / group=name markerattrs=(symbol=circlefilled size=20);
  yaxis offsetmin=0;
  run;

Thirteen.png

LB
Quartz | Level 8 LB
Quartz | Level 8

On another note is there also another way to set it so that a color does not repeat the original graphdata element w/o specifying every color? I see a repeating black color.

Thanks

Lawrence

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
  • 8 replies
  • 1653 views
  • 3 likes
  • 3 in conversation