BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi All,

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.

Thanks !
8 REPLIES 8
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest looking at using ODS PDF along with PROC PRINTTO.

Scott Barry
SBBWorks, Inc.
Cynthia_sas
SAS Super FREQ
Hi:
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.

cynthia
David_SAS
SAS Employee
In SAS 9.2, PROC DOCUMENT has the undocumented capability to import text files. Try:
[pre]
ods listing file="myoutput.lst";
proc print data=sashelp.class;
run;
ods listing;
proc document name=temp(write);
import textfile="myoutput.lst" to ^;
ods pdf file="myoutput.pdf" notoc;
replay;
run;
quit;
ods pdf close;
[/pre]

-- David Kelley, SAS
deleted_user
Not applicable
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.

The solution that I'm using is basically

options sysprint="CutePDF Writer" "&path\&g_SAS_START_NAME..ps";

filename pdf printer;

proc printto print=pdf new;
run;

proc printto print=print;
run;

options noxwait;

%sysexec( "c:\program files\gs\gs8.64\bin\gswin32c.exe" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="&path\&g_SAS_START_NAME..pdf" -f "&path\&g_SAS_START_NAME..ps" ) ;

%sysexec( del "&path\&g_SAS_START_NAME..ps" ) ;

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.

Would anybody have any ideas about that ?

Thank you.
Ksharp
Super User
Would you use PrintScreen key in the keyboard to get a snapshot screen.
then convert the picture into pdf ????
Cynthia_sas
SAS Super FREQ
Hi:
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:

-dORIENT1=true
-dORIENT1=false
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.


cynthia
deleted_user
Not applicable
Hi Cynthia,

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.
Cynthia_sas
SAS Super FREQ
Well reinstalling would have cleaned up all your print drivers for sure. But your best way to resolve this issue definitively would be to open a track with Tech Support.

Cynthia

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
  • 8 replies
  • 1919 views
  • 0 likes
  • 5 in conversation