Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
554 views
in Technique[技术] by (71.8m points)

sas ods - Is it possible to import a PNG file into SAS to include in RTF output?

I have PNG files that were created outside of SAS that I would like to include in an RTF file that I will output from SAS using ODS. Is it possible to use SAS to do this? My internet searches are turning up a lot of irrelevant results.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

ODS RTF: The Basics And Beyond, is certainly relevant. Here's an example of doing this in body text not using the title.

ods rtf file="c:empest.rtf" startpage=never;
ods escapechar='^';
proc print data=sashelp.class;
run;
ods text='^S={preimage="C:empSGPlot.jpeg" just=c}';
proc print data=sashelp.class;
run;
ods rtf close;

That's using a random SGPLOT I had laying around, but of course you can use whatever you prefer. I added startpage=never to have it put things on the same page - but of course that's optional (otherwise it'll put the image on its own page in my example).

The important thing is the ods text (which puts some text, normally), the ods escapechar (which sets ^ to be the escape character), and then ^S={ } which is how you insert styles and similar things in RTF (and other destinations). Then we just use preimage which means put an image before the next bit (the text, which is blank here). You could just as easily have put this in the title statement, rather than ods text, if that's where you want the image.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...