I would like to redirect SAS output window into a PDF file. I'd like that output
to look EXACTLY like the output in the SAS window.
I'm using a solution based on an external PDF printer ( CutePDF ) and
a call to ps2pdf from inside the SAS system. There is a problem with it
though on my SAS 9.2, so I'd appreciate if someone could suggest a
solution based on SAS internal functionality.
You could change a style template to use all "fixed" pitch SAS Monospace fonts and you'd come close to the look and feel of the LISTING window, as explained in this Tech Support note: http://support.sas.com/kb/24/493.html
I have successfully used a Text2PDF command line processor which was offered by the FyTek company. At the time I was investigating the ability to translate a PROC PRINTTO-saved LISTING file....and Text2PDF was just one of many tools available, but not all of the products had command line interface. I used an X command to kick off the Text2PDF conversion.
Personally, I find that changing the template comes close enough to what I need to do...the command line method was sort of klunky.
In SAS 9.2, PROC DOCUMENT has the undocumented capability to import text files. Try:
ods listing file="myoutput.lst";
proc print data=sashelp.class;
proc document name=temp(write);
import textfile="myoutput.lst" to ^;
ods pdf file="myoutput.pdf" notoc;
ods pdf close;
Thanks for comments everybody. The problem with Cynthia and Dave's approaches is that the outputs do not look exactly like in the SAS output
window. And I indeed need it to look 100% the same. I mean it.
This one worked in SAS 9.1 like a charm, but in SAS 9.2 it switches to
a portrait mode at some point, and the only way to fix it is to reinstall SAS 9.2.
I did it a couple of times already, but after running some code
( I think it's proc gplot producing tiffp device output or something ),
it switches back to portrait. I was not able to find any setting inside
SAS 9.2 to get it back into a landscape mode. Interestingly,
the output window still produces the lanscape format, and if I print
it to a file directly from the output window, it gives me landscape as well.
Is gswin32c.exe a Ghostscript command??? Is it possible that GhostScript is not using the SAS settings for orientation?? It sounds like SAS is respecting the landscape orientation, but the problem is that your -other- software needs to have its orientation set.
For example, this documentation on using Ghostscript has an explicit instruction on changing paper size: http://pages.cs.wisc.edu/~ghost/doc/cvs/Use.htm#Change_default_size
and the section on page parameters http://pages.cs.wisc.edu/~ghost/doc/cvs/Use.htm#Parameter_switches
talks about using the dOrient parameter:
Defines the meaning of the 0 and 1 orientation values for the setpage[params] compatibility operators. The default value of ORIENT1 is true (set in gs_init.ps), which is the correct value for most files that use setpage[params] at all, namely, files produced by badly designed applications that "know" that the output will be printed on certain roll-media printers: these applications use 0 to mean landscape and 1 to mean portrait. -dORIENT1=false declares that 0 means portrait and 1 means landscape, which is the convention used by a smaller number of files produced by properly written applications.
thanks. In fact, I tried all that, even reinstalling CutePDF and GS, but the only
thing that helped is re-installing SAS 9.2. This makes me think the problem is
actually inside SAS. There is a setting somewhere in it, which controls it, and I was not able to find it yet.
I could post a dump of proc options and/or other things if it helps.