BookmarkSubscribeRSS Feed
ssmith
Fluorite | Level 6

Folks, 

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?  

7 REPLIES 7
Tom
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.

ssmith
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!

Tom
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.

 

Tom
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.

https://github.com/scottbass/SAS/blob/master/Macro/txt2pdf.sas

Reeza
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?

http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p14qidvs5xf7omn14omm...

 

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;
Tim_SAS
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.

ssmith
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!

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 1606 views
  • 2 likes
  • 4 in conversation