BookmarkSubscribeRSS Feed
Kinston
Calcite | Level 5

 Hi experts,

 the code below gives a pdf output to a printer but I want to change the output to word or excel.

 can anyone help? if i need to change all the code can someone help me with the new code that can truly send an excel or rft  output to a printer?

thanks.


%let device=PDFCT; /*to print pdf*/
/*%let device=LJIVPS; *//*to printer*/
%let targetdevice=LJIVPS; /*dont change the target device*/

 

goptions
targetdevice=&targetdevice
device=&device
%if %upcase(&device) eq LJIVPS or %upcase(&device) eq PDFCT %then %do;
gaccess=gsasfile
%end;
gunit=pct
rotate=portrait
nodisplay
;
%let page_count=39; /*one less then start page*/

1 REPLY 1
ballardw
Super User

You may need to provide more information but generally:

 

ods rtf file="c:\path\mydocname.rtf";

 

/* your procedures that generate output. NOTE: DO not direct output to devices directly*/

 

ods rtf close;

 

with put the output into an RTF file you specify with the file part of the ODS RTF statement that WORD can read.

 

Since you are using GDEVICE type statements it is hard to know what other setting you may have that effect output.

Depending on what you are doing you may have appearance issues at the end as ODS Styles will control many of the appearance options.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 1199 views
  • 0 likes
  • 2 in conversation