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

Hello! I want to add data markers to my graph so the lines can still be differentiated in black and white, but I can't get it to work. Here is my code: 

ods graphics on / attrpriority=none;
proc sgpanel data=pwid.graph;
	panelby icd / uniscale=row columns=2 novarname noheader proportional;
	inset icd / position=topleft nolabel textattrs=(size=10);
	format icd icdf. year yearf.;
	styleattrs datalinepatterns=(solid) datasymbols=(circlefilled starfilled trianglefilled diamondfilled);
	series x=year y=rate / group=disease lineattrs=(thickness=2) legendlabel="Disease";
	rowaxis offsetmax=0.1 label="Cases per 100,000" values=(0 1 2 3 4 5 6);
	colaxis label="Year" type=discrete fitpolicy=rotate;
run;
ods graphics / reset;

I've tried removing the datalinepatterns and datasymbols statements, as well as the styleattrs statement entirely, but I haven't managed to get markers to appear. From my understanding, the attrpriority=none option should make SAS differentiate the lines by colors, line type, and data markers, but it only is changing colors and line type. I've attached the graph I get from this code.

 

For reference, this graph is looking at disease rates over time, paneled by ICD code. The data structure is as follows: 

data pwid.graph;
	input year disease icd rate;
	datalines;
	2011 1 9 0.26
	2011 2 9 0.04
	2011 3 9 0.16
	2011 4 9 0.15
	...
	2016 1 10 2.33
	2016 2 10 1.08
	2016 3 10 0.92
	2016 4 10 1.12
	;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Have you tried the option MARKERS on the Series statement:

   series x=year y=rate / group=disease 
         lineattrs=(thickness=2) legendlabel="Disease"   markers
   ;

View solution in original post

3 REPLIES 3
ballardw
Super User

Have you tried the option MARKERS on the Series statement:

   series x=year y=rate / group=disease 
         lineattrs=(thickness=2) legendlabel="Disease"   markers
   ;
megsredl
Obsidian | Level 7

That worked, thank you so much! I didn't realize you needed to explicitly add markers when attrpriority=none.

DanH_sas
SAS Super FREQ

For the SERIES statement, that MARKERS option is always required to show markers, independent of ATTRPRIORITY setting.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1033 views
  • 1 like
  • 3 in conversation