BookmarkSubscribeRSS Feed
Fluorite | Level 6


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?  

Super User Tom
Super User

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.

Fluorite | Level 6

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!

Super User Tom
Super User

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.


Super User Tom
Super User

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.

Super User

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;
Barite | Level 11

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.

Fluorite | Level 6

Thank you very much for all of your replies, it seems I have some reading to do! 

Tom, that utility is really neat, thanks for that!


Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 4 in conversation