The code below produces a report in Arial Narrow, as desired, in the HTML results window, but in Helvetica in the RTF file. So perplexing. Why are my instructions being overridden by some random default?
Hi:
Fonts have to be registered in SAS before you can use them. You can see if Arial Narrow is registered to SAS by running the following PROC REGISTRY step:
proc registry startat="\CORE\PRINTING\FREETYPE\FONTS" list;
run;
Is Arial Narrow listed in the log?
I had the same issue you experienced, with Arial Narrow not being used. However, I needed to run PROC FONTREG to add Arial Narrow to the SAS Registry:
proc fontreg mode=all msglevel=verbose;
fontfile "c:\windows\fonts\arialn.ttf";
run;
The name of Arial Narrow is arialn.ttf (True Type Font).
And after I used PROC FONTREG to update the SAS Registry then this code worked as expected.
I ran the code in 9.4M7, but I would expect that 9.4M8 would work the same way.
If using PROC FONTREG doesn't work you may need to get help from your system admin or SAS Tech Support. I did my test on Windows, however keep in mind that Arial may not be a font that's available on a Linux/Unix/mainframe system.
Cynthia
Hi:
Fonts have to be registered in SAS before you can use them. You can see if Arial Narrow is registered to SAS by running the following PROC REGISTRY step:
proc registry startat="\CORE\PRINTING\FREETYPE\FONTS" list;
run;
Is Arial Narrow listed in the log?
I had the same issue you experienced, with Arial Narrow not being used. However, I needed to run PROC FONTREG to add Arial Narrow to the SAS Registry:
proc fontreg mode=all msglevel=verbose;
fontfile "c:\windows\fonts\arialn.ttf";
run;
The name of Arial Narrow is arialn.ttf (True Type Font).
And after I used PROC FONTREG to update the SAS Registry then this code worked as expected.
I ran the code in 9.4M7, but I would expect that 9.4M8 would work the same way.
If using PROC FONTREG doesn't work you may need to get help from your system admin or SAS Tech Support. I did my test on Windows, however keep in mind that Arial may not be a font that's available on a Linux/Unix/mainframe system.
Cynthia
Worked like a charm. Thanks, so much, Cynthia.
Hi there. Many SAS installs may not have particular fonts available in the SAS registry. The way to make this happen is to use PROC FONTREG with the FONTPATH statement, after downloading the Arial font family into the FONTPATH directory. Note that your install may not allow you to mess with the registry and/or system fonts, so use your own folder to add the desired font for the duration of your session - the fontpath allows you to grab a font from anywhere. Be aware that this is temporary! You will want to make sure the fontembedding system option is set.
options fontembedding ps=55 ls=175 errorabend;
libname dd '.';
filename odsout '.';
run;
title1 "HPOG rtf test";
run;
proc fontreg msglevel=verbose;
fontpath 'S:\projects\QRPVBP\HH_QRP\_Source_Data\iQIES\OASIS\2023Q1_2023Q4\sandbox';
run;
NOTE: The font "Arial Narrow" (Style: Regular, Weight: Normal) has been added to the SAS Registry at [CORE\PRINTING\FREETYPE\FONTS\<ttf> Arial Narrow]. Because it is a TRUETYPE font, it can be referenced as "Arial Narrow" or "<ttf> Arial Narrow" in SAS. The font resides in file
"S:\projects\QRPVBP\HH_QRP\_Source_Data\iQIES\OASIS\2023Q1_2023Q4\sandbox\ARIALN.TTF".
NOTE: The font "Arial Narrow" (Style: Regular, Weight: Bold) has been added to the SAS Registry at [CORE\PRINTING\FREETYPE\FONTS\<ttf> Arial Narrow]. Because it is a TRUETYPE font, it can be referenced as "Arial Narrow" or "<ttf> Arial Narrow" in SAS. The font resides in file
"S:\projects\QRPVBP\HH_QRP\_Source_Data\iQIES\OASIS\2023Q1_2023Q4\sandbox\ARIALNB.TTF".
NOTE: The font "Arial Narrow" (Style: Italic, Weight: Bold) has been added to the SAS Registry at [CORE\PRINTING\FREETYPE\FONTS\<ttf> Arial Narrow]. Because it is a TRUETYPE font, it can be referenced as "Arial Narrow" or "<ttf> Arial Narrow" in SAS. The font resides in file
"S:\projects\QRPVBP\HH_QRP\_Source_Data\iQIES\OASIS\2023Q1_2023Q4\sandbox\ARIALNBI.TTF".
NOTE: The font "Arial Narrow" (Style: Italic, Weight: Normal) has been added to the SAS Registry at [CORE\PRINTING\FREETYPE\FONTS\<ttf> Arial Narrow]. Because it is a TRUETYPE font, it can be referenced as "Arial Narrow" or "<ttf> Arial Narrow" in SAS. The font resides in file
"S:\projects\QRPVBP\HH_QRP\_Source_Data\iQIES\OASIS\2023Q1_2023Q4\sandbox\ARIALNI.TTF".
Then add the font group.
proc fontreg;
fontfile '<ttf> Arial Narrow';
run;
data SimpleTest;
input treatment trainingMonths_LO;
cards;
1 13
0 12
1 10
0 3
;
run;
ods rtf file='.\vanillaTest.rtf'; /* will use the default style template for RTF */
proc report data=SimpleTest
style(report)=[fontfamily="'Arial Narrow'"]
style(header)=[fontfamily="'Arial Narrow'"]
style(column)=[fontfamily="'Arial Narrow'"];
column treatment (Mean Std),trainingMonths_LO;
define treatment/group;
define trainingMonths_LO/format=6.2;
title2 'Months of training - Vanilla';
run;
ods rtf close;
ods rtf file='.\defineTest.rtf'; /* adds font specs to the define statements */
proc report data=SimpleTest
style(report)=[fontfamily="'Arial Narrow'"]
style(header)=[fontfamily="'Arial Narrow'"]
style(column)=[fontfamily="'Arial Narrow'"];
column treatment (Mean Std),trainingMonths_LO;
define treatment / group style(COLUMN)={just=c font_face="Arial Narrow" foreground=navy
font_size=9pt cellwidth=180 }
style(HEADER)={just=c font_face="Arial Narrow" font_weight=bold
font_size=9pt };
define trainingMonths_LO / style(COLUMN)={just=c font_face="Arial Narrow" foreground=navy
font_size=9pt cellwidth=180 format=6.2}
style(HEADER)={just=c font_face="Arial Narrow" font_weight=bold
font_size=9pt };
title2 'Months of training - add style override';
run;
ods rtf close;
Both tests that use the style statements / overrides succeed in using the Arial Narrow font. PROC FONTREG is pretty cool - especially if you want to write in Klingon font.
https://www.lexjansen.com/nesug/nesug07/po/po12.pdf
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.