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;
Have you tried the option MARKERS on the Series statement:
series x=year y=rate / group=disease
lineattrs=(thickness=2) legendlabel="Disease" markers
;
Have you tried the option MARKERS on the Series statement:
series x=year y=rate / group=disease
lineattrs=(thickness=2) legendlabel="Disease" markers
;
That worked, thank you so much! I didn't realize you needed to explicitly add markers when attrpriority=none.
For the SERIES statement, that MARKERS option is always required to show markers, independent of ATTRPRIORITY setting.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.