07-20-2016 12:44 PM
I often am required to print to pdf the contents of the output window. I would like to do this programatically, but can't find any means to do so. I am familiar with outputing the contents to *.lst files, and I am familiar with ODS pdf output, but neither work in this case as I am required to maintain the style of the output window, and ods adds formatting, and the *.lst file has to be opened in sas. Is there a way to remove the formatting that comes with ods pdf by default so that it matches the output window?
07-20-2016 12:55 PM
To print the output WINDOW to PDF just use any one of the tools that allow you to print to a PDF file instead of an actual printer.
To convert the .lst file then use a tool that converts a text file to a PDF file. You could possible do both with the same tool.
07-20-2016 12:59 PM
I have access to all adobe products, and can print the output window to pdf manually, but is there a way to do that programatically? I think I am missing something here. Thank you for your quick reply!
07-20-2016 01:23 PM
If you are using Display Manager then you can use the DM command to issue commands. I am sure there is one to print and there are ways to set the default destination for the printer.
What we used to do was issue the display manager command to print the output (or log) window to a file and then save and or send that file where we wanted. It was better to use the PRINT FILE= command instead of the FILE command because then the form feeds between pages where included.
What we used to do for a text file was run it through a publicly available text to postscript toool (GhostWriter perhaps?) and then run it through Adobe's distiller program to generate a PDF file from the postscript file.
07-20-2016 01:27 PM
Many years ago I also adapted a publicly available SAS program that wrote PDF file format directly. I see that Scott Bass has a version of it on line.
07-20-2016 01:24 PM
When using ODS PDF you can modify the STYLE.
I don't know if there's a style that mimics the LST output identically but you can strip a lot of the formatting from it.
Monospace seems similar to LST?
If you're really motivated you can probably customize one to what you want.
ODS PDF file='sample.pdf' style=minimal; *sas code; ODS PDF close;
07-20-2016 01:32 PM
Well, you can't "remove" the formatting but you can change it. When you say "the output window" are you talking about the old monospace output window or the new (SAS 9.3) HTML output? If the old, then you might try using the Monospace style on your PDF output. If the new HTML output, then use the HTMLBlue style.