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

拜拜、爱过 提交于 2019-11-28 09:33:57

问题


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.


回答1:


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:\temp\test.rtf" startpage=never;
ods escapechar='^';
proc print data=sashelp.class;
run;
ods text='^S={preimage="C:\temp\SGPlot.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.



来源:https://stackoverflow.com/questions/31303403/is-it-possible-to-import-a-png-file-into-sas-to-include-in-rtf-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!