BookmarkSubscribeRSS Feed
fastb
Fluorite | Level 6

Hi,

 

In order to have complete documentation of the analyses that I perform, I have SAS print the code and the log to pdf using proc document replay and ods pdf.

I used proc template to create a style called "Printouts" for these, and in that file I specify 1 inch margins.  It works perfect for the code, but when I open the pdf that contains the log, the left margin is about 2.5 inches instead of 1.

 

Why is the left margin of the log file not the 1.0 inch that is specified in the style?  Is there maybe another style element besides the margin that I need to modify?

 

Any input greatly appreciated!

 

See code below; results are exported to a folder in your C drive titled "SAS Printouts".

 

DM 'LOG;CLEAR;OUT;CLEAR;'; OPTIONS LS=128 PAGESIZE=36 NONUMBER;

FILENAME elog 'C:\SAS Printouts\99. LOG.log'; PROC PRINTTO log = elog; RUN;

 

*SAS code from each analysis will be placed here;

 

PROC TEMPLATE; DEFINE STYLE Styles.printouts; PARENT = STYLES.Journal;

style header from header/just=left; style data from data/just=left; style rowheader from header/just=left;

style body from document/ leftmargin=1.0in rightmargin=1.0in topmargin=1.0in bottommargin=1.0 in just=left;

style fonts from fonts/

'FixedFont' = ("Courier",6pt); END; RUN; quit;

PROC DOCUMENT NAME=CODE(WRITE);

IMPORT TEXTFILE = 'C:\SAS Printouts\Printout Test.SAS' TO^; RUN;

ODS PDF STYLE = printouts; OPTIONS ORIENTATION = PORTRAIT NODATE

leftmargin=1.0in rightmargin=1.0in topmargin=1.0in bottommargin=1.0 in;

ODS PDF FILE = 'C:\SAS Printouts\97 Code.pdf' NOTOC;

REPLAY; RUN; quit; ODS PDF CLOSE; QUIT;

PROC PRINTTO; RUN;

PROC DOCUMENT NAME = LOG(WRITE);

IMPORT TEXTFILE = 'C:\SAS Printouts\99. LOG.log' TO^; RUN;

ODS PDF STYLE = printouts; OPTIONS ORIENTATION = PORTRAIT NODATE

LEFTMARGIN = 1.0in RIGHTMARGIN = 1.0in TOPMARGIN = 1.0in BOTTOMMARGIN = 1.0IN;

ODS PDF FILE = 'C:\SAS Printouts\98. LOG.pdf' NOTOC;

REPLAY/ dest=(pdf); RUN; QUIT; ODS PDF CLOSE;

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Why would you want to print code and log to pdf?  Are you not just creating a feedback loop, i.e. you print the code you are running out, but to do that you create code, so you should print that out as well, and then that needs printing out...

Doesn't make sense.  If you are using a version control system, which you should be under a validated programming environment, then you have full audit and change log.  The log can also be stored in that, and you would have some kind of logcheck program to pick up on errors.  At the end of the day, printing code and log out wouldn't prove anythinig to an auditor, you would need to link it to output files at the given time etc.

ballardw
Super User

I think part of the reason is that Printto isn't intended to honor ODS but sent direct to printer or text file. From the online documentation:

Proc Printo statement Defines destinations, other than ODS destinations, for SAS procedure output and for the SAS Log.

(my emphasis added)

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
  • 2 replies
  • 1667 views
  • 0 likes
  • 3 in conversation