Hi,
I'm creating a map with labels and I'm running into readability issues. The map has about nineteen automatically generated colours, so labels aren't always fully contrasting with the background. I figured that a way to solve for this problem is to use a white coloured font that is outlined with a black line.
Is there a way to outline fonts in SAS without having to install a new font?
My current map looks like this:
I would like the font to look like this:
The code I use to define my labels:
data anno_labels;
set a1;
xsys='2';
ysys='2';
hsys='3';
when='a';
function='label';
position='5';
size=2.0;
color='black';
text=column1;
run;
You may want to investigate the CBOX option to set a standard color of the "box" that the text appears in to address the contrast between text and map area colors.
There should be catalog, SASHELP.FONTS that contains the fonts SAS Graph uses. The fonts whose names end in E, for 'empty', are outline fonts. SWISSE might be likely candidate as it is similar to Helvetica . From the documentation:
All of the SAS/GRAPH fonts are stored in the catalog SASHELP.FONTS. For many fonts, the last letter or letters of the font name indicates weight or spacing of the font:Bbold (thicker)Eempty (outline) versions of their counterpartsIitalic (slanted)Llight (thin)Uuniformly spaced versions of their counterparts; most of the SAS/GRAPH fonts that do not end in U are proportionately spaced. However, the kanji fonts are always uniform.Xexpanded (wider characters and extra space between characters).CAUTION:Empty and uniform versions of fonts cannot be used if you have deleted their filled or proportionally spaced counterparts.
The Style= option should set the font for the text of a Label function for the specific text. Use in your data set would be
style='Your font name goes here';
What procedure are you using to draw the map? The SG procedures (which includes PROC SGMAP) support the BACKFILL, OUTLINE, and BACKLIGHT options. You can experiment with those options to create effects like you want. Here is a link to the SGMAP doc.
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.