Hi, I was trying to draw a series plot by group and display the every group's name in the legend. One of the groups represents a range "<= xx mg". However, I want its label to be displayed as the sepcial character of less than or equal to sign instead of the combination of "<" and "=" in the plot. This is the sample data and code:
DATA plot;
INPUT year value group$;
CARDS;
1 10 <=50
2 15 <=50
3 20 <=50
4 25 <=50
5 30 <=50
1 10 >50
2 30 >50
3 50 >50
4 70 >50
5 90 >50
;
proc sgplot data=plot;
series x=year y=value / group=group;
run;
I've tried to replace with "(*ESC*){unicode '2264'x} 50" in the dataset, but it didn't work in PROC SGPLOT. Is there any way to display the right special character in the plot?
proc format;
value $group '<=50' = "(*ESC*){unicode '2264'x} 50";
quit;
proc sgplot data=plot;
series x=year y=value / group=group;
format group $group.;
run;
proc format;
value $group '<=50' = "(*ESC*){unicode '2264'x} 50";
quit;
proc sgplot data=plot;
series x=year y=value / group=group;
format group $group.;
run;
Thank you so much! It's perfect.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.