The SAS Output Delivery System and reporting techniques

How to change font face in ODS RTF output via Unix batch mode

Accepted Solution Solved
Reply
Contributor sm4
Contributor
Posts: 51
Accepted Solution

How to change font face in ODS RTF output via Unix batch mode

I've been able to use Base SAS to produce a perfect ODS RTF file for my needs. Now I want to do the same thing in batch mode in Unix. Everything works fine except font - in Base SAS, I had been using proc template to set font to Georgia globally:

 

ods path(prepend) work.templat(update); *Added this in Unix batch mode code because of a separate issue;

proc template;
	define style styles.hello;
		class usertext / 
			font_size = 11pt
			font_face = Georgia;

		class body /
			topmargin = 1.0in
			leftmargin = 0.75in
			rightmargin = 0.75in;
	end;
run;


When I try this in batch mode, I get this nice log note right after that step: NOTE: STYLE 'Styles.hello' has been saved to: WORK.TEMPLAT

But at the very end of my log, after all of my ods rtf text= statements and my ods rtf close statement, I get multiple of these warnings:

WARNING: Font specification "Georgia" failed. Using default font family instead.

 

Margins and font_size are all fine in the output, it's just the font that did not work. I've tried changing the font through inline formatting for individual text= statements too, but it didn't work (though font_weight and foreground color worked that way). Thus my guess is that the proc template syntax is fine, but the font isn't registered or something like that. 

 

Any ideas on how to solve this? I've googled it pretty thoroughly and haven't found anything. I need to use Georgia because it's an official organization font.

Thanks!!

 


Accepted Solutions
Solution
‎01-24-2018 06:36 PM
SAS Super FREQ
Posts: 9,424

Re: How to change font face in ODS RTF output via Unix batch mode

You might try the FreeType fonts that are included with SAS starting in 9.2: Albany AMT, Cumberland AMT and Thorndale AMT. Albany is similar to Arial; Cumberland to Courier; and Thorndale to Times.

Otherwise, you have to install the fonts on your system and then register them with SAS using FONTREG.

cynthia

View solution in original post


All Replies
Super User
Posts: 23,958

Re: How to change font face in ODS RTF output via Unix batch mode

You need to install the font into your system, which I don't think is a SAS specific issue. 

Or maybe it's not in your library of SAS fonts, but for some reason I think it uses the system fonts. 

Contributor sm4
Contributor
Posts: 51

Re: How to change font face in ODS RTF output via Unix batch mode

Thanks for your response!

I figured it was something like that.
So, specifically, I need to install the font in my Unix system? If you have a good link for that I would really appreciate it! I’ve googled a bunch and it’s not too clear (or I’m not knowledgeable).

Thanks again!
Solution
‎01-24-2018 06:36 PM
SAS Super FREQ
Posts: 9,424

Re: How to change font face in ODS RTF output via Unix batch mode

You might try the FreeType fonts that are included with SAS starting in 9.2: Albany AMT, Cumberland AMT and Thorndale AMT. Albany is similar to Arial; Cumberland to Courier; and Thorndale to Times.

Otherwise, you have to install the fonts on your system and then register them with SAS using FONTREG.

cynthia
Contributor sm4
Contributor
Posts: 51

Re: How to change font face in ODS RTF output via Unix batch mode

Posted in reply to Cynthia_sas

Thanks for your response! It worked!

For others:
After some digging, I established that Georgia is in fact installed on my Unix system and located its path. I then added to the top of my code a proc fontreg mode=add with fontpath directing to that directory. I got a really encouraging message:

SUMMARY:
Files processed: 82
Unusable files: 3
Files identified as fonts: 79
Fonts that were processed: 79
Fonts replaced in the SAS registry: 0
Fonts added to the SAS registry: 0
Fonts that could not be used: 79
Font Families removed from SAS registry: 0

It did not give me the previous error relating to Georgia failing, instead it gave this: 
"ERROR:  An exception has been encountered.

Please contact technical support and provide them with the following traceback
information:

The SAS task name is [SQL (2) ]
Segmentation Violation"
Underneath was a bunch of lines referencing the SAS 9.4 folder in the Unix system.

I was about to post this new problem when I tried running the same code again - and the second time got no error message and the output is in Georgia! Let's hope it continues to do this on a monthly basis or I'll have to come back here lol.

Thanks to both of you for the extremely relevant help!!!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 232 views
  • 0 likes
  • 3 in conversation