Automatic Conversion of SAS Enhanced Programs to PDF



Similar documents
Best practices for producing high quality PDF files

PDF Export for Capture Designs. OrCAD Capture and Allegro DE CIS from version SPB 16.3, Hotfix 13

PDF Export for Capture Designs. OrCAD Capture and Allegro DE CIS since version SPB 16.3, Hotfix 13

Business & Decision Life Sciences How SAS Can Help with RTF Files

Preservation Handbook

Adobe Acrobat 9 Pro Accessibility Guide: Creating Accessible PDF from Microsoft Word

Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC

Perfect PDF 8 Premium

Adobe Acrobat 9 Pro Accessibility Guide: PDF Accessibility Overview

SOLO NETWORK (11) (21) (31) (41) (48) (51) (61) version Adobe PageMaker 7.

Quick Start Guide. Managing the Service. Converting Files and Folders

Spelling Checker Utility in SAS using VBA Macro and SAS Functions Ajay Gupta, PPD, Morrisville, NC

How To Write A Clinical Trial In Sas

Ansur Test Executive. Users Manual

Using the Acrobat tab in Microsoft Word: Setting PDF Preferences

PharmaSUG Paper AD03

deskpdf 2.5 Professional User Guide

Pageflex Persona Cross Media Suite

EXTRACTING DATA FROM PDF FILES

My Account User Guide. Popfax.com login page. Easy, inexpensive Effective!

bbc PDF/A-1 in Acrobat 9 and LiveCycle ES PDF/A-1 PDF/A Generation and validation principles APPLIES TO CONTENTS Update March 2009

Report Customization Using PROC REPORT Procedure Shruthi Amruthnath, EPITEC, INC., Southfield, MI

Qualification Process for Standard Scripts in the Open Source Repository with Cloud Services

Switching from PC SAS to SAS Enterprise Guide Zhengxin (Cindy) Yang, inventiv Health Clinical, Princeton, NJ

Setting up and Automating a MS Dynamics AX Job in JAMS

White Paper. Configuration of Fabasoft Folio Printer Ports. Fabasoft Folio 2015 Update Rollup 2

How to embed fonts in a PDF from LaTeX

ithenticate User Manual

Statistical Operations: The Other Half of Good Statistical Practice

Adobe Acrobat 6.0 Professional

(1) latex + dvipdfm (which is a DVI to PDF translator) or (2) pdflatex (a version of LaTeX that generates PDF output instead of DVI).

OpenIMS 4.2. Document Management Server. User manual

Using Adobe Acrobat X Professional

Application Notes "EPCF 1%' 1SJOU &OHJOF "11&

PEERNET File Conversion Center 6.0

Introduction to Zetadocs for NAV

NØGSG DMR Contact Manager

RJS Software Systems Inc AS/400 Report Delivery System

Choosing the Best Method to Create an Excel Report Romain Miralles, Clinovo, Sunnyvale, CA

Combining SAS LIBNAME and VBA Macro to Import Excel file in an Intriguing, Efficient way Ajay Gupta, PPD Inc, Morrisville, NC

Planning for External Printing Services

Chapter 11 Compound Documents in Windows 3.1

bbc Creating a Purchase Order Form Adobe LiveCycle Designer ES2 November 2009 Version 9

Features compared: Worldox Productivity Suite modules and the full version of those products from DocsCorp

Basics. a. Click the arrow to the right of the Options button, and then click Bcc.

ELFRING FONTS UPC BAR CODES

II. Instructions for Formatting Your Thesis

Anoto pendocuments. User s Guide

Logging In From your Web browser, enter the GLOBE URL:

ebooks: From Adobe InDesign to the Kindle Store

Preparing a File For Commercial Printing using Microsoft Publisher

Adobe InDesign Server CS2

SUDT AccessPort TM Advanced Terminal / Monitor / Debugger Version 1.37 User Manual

Digital Asset Management

PharmaSUG Paper QT26

Combining External PDF Files by Integrating SAS and Adobe Acrobat Brandon Welch, Rho, Inc., Chapel Hill, NC Ryan Burns, Rho, Inc.

Express Technology. Maintenance Solutions Express Technology Inc.

HP INTEGRATED ARCHIVE PLATFORM

PDF Forms Advantages and application possibilities of electronic forms in PDF format

bbc Developer FAQ Adobe Acrobat SDK November 2006 Version 8.0

ithenticate User Manual

Tic, Tie & Calculate Quick Start Guide. Quick Start Guide

2. Basic operations

ABSTRACT INTRODUCTION WINDOWS SERVER VS WINDOWS WORKSTATION. Paper FC02

Multi Source Input Multi Channel Output

Embedded Special Characters Kiran Karidi, Mahipal Vanam, and Sridhar Dodlapati

Quickstart Tutorial. Bradford Technologies, Inc. 302 Piercy Road, San Jose, California fax

ABBYY PDF Transformer+ User s Guide

Installing TCP/IP (Network) Printers

ICPPP484C Set up and operate automated workflow

Producing Structured Clinical Trial Reports Using SAS: A Company Solution

Metadata in Microsoft Office and in PDF Documents Types, Export, Display and Removal

Microsoft Word 2013 Tutorial

ithenticate User Manual

ImageNow User. Getting Started Guide. ImageNow Version: 6.7. x

Guide to the essentials of creating accessible PDFs with Microsoft Word and Acrobat Professional 8

DCA. Document Control & Archiving USER S GUIDE

InfoCenter Suite and the FDA s 21 CFR part 11 Electronic Records; Electronic Signatures

Course Syllabus. Technical Writing Certificate - Basic

PDF Accessibility Overview

Using Adobe Acrobat X to enhance collaboration with Microsoft SharePoint and Microsoft Office

1 Using CWEB with Microsoft Visual C++ CWEB INTRODUCTION 1

Nuance Power PDF Advanced.

Create Adobe. PDF Files for Print and Press. Adobe Acrobat 4 Edition

How To Create PDF Files For Free Under Windows 2000/XP

Installing Settings (Job Options) Files for Use with Acrobat Distiller, Adobe Printer, or PDFMaker (For Windows)

Preparing graphics for IOP journals

Processing PDF/A Documents

Quick Reference Guide

Using FileMaker Pro with Microsoft Office

Archiving digital documents and s in PDF/A

e CABINET AND DOCULEX Document Capture and Electronic File Conversion

Create a PDF File. Tip. In this lesson, you will learn how to:

SIMATIC. WinCC V7.0. Getting started. Getting started. Welcome 2. Icons 3. Creating a project 4. Configure communication 5

Transcription:

PhUSE 2009 Paper PO13 Automatic Conversion of SAS Enhanced Programs to PDF Dirk Spruck, Accovion, Marburg, Germany Piia-Piret Eomois, German Cancer Research Center, Heidelberg, Germany ABSTRACT This paper describes a method how SAS programs can automatically be converted to PDF documents. To increase readability of the programs not only plain text is converted but instead the colored program code from the Windows SAS Enhanced Editor is used. In a first step the programs are opened in the SAS Enhanced Editor, which became available under Windows with SAS Version 8. The enhanced program text then is copied to the clipboard using SAS DM commands, one of them barely documented and hard to find. The process continues by opening Word from within SAS and inserting the copied text from the clipboard into a new Word document using Dynamic Data Exchange (DDE) technology. In a last step the Word document is converted to PDF. INTRODUCTION SAS programs are typically stored as plain ASCII files. However, lately there has been a raising demand for SAS programs to be published and submitted as PDF documents to the regulatory authorities, e.g. Food and Drug Administration. This can be attributed to the increasing number of ectd submissions and the study data specification of the ectd guidelines requesting SAS programs in ASCII and PDF format [1]. Storing SAS programs in PDF format could also be used as a way for archiving and annotating SAS programs. The SAS Enhanced Editor which is supplied with the Windows version of SAS offers the nice feature of color coding, which increases readability of programs [Figure 1]. Figure 1: Rich Text Code from Enhanced Editor compared to plain text - 1 -

When SAS programs are converted to PDF documents it would be nice to keep this color coding intact. Unfortunately SAS (at least up to version 9.1) does not offer the capability to save the program in any other format than plain text although LOG files can already be saved as RTF documents (LOG window -> File -> Save As -> Save as file type: RTF files). Although enhanced SAS programs can not directly be saved in PDF or RTF this paper will introduce a process to automatically convert programs to a Rich Text Format (RTF) document, which then can be converted into PDF. COPY CODE FROM SAS ENHANCED EDITOR TO CLIPBOARD Before the SAS program can be processed it needs to be loaded into the SAS Enhanced Editor and then copied to the clipboard. This seems to be an easy task but in fact this was the most difficult piece of the process. The bits and pieces needed appeared to be poorly documented and were finally found in the SAS usage notes [2]. The following SAS DM commands were used to copy the SAS code to the paste buffer / clipboard: dm 'whostedit; ❶ include "<insert program name here>"; ❷ EDCMD selectall; ❸ EDCMD copy; ❹ EDCMD winclose;' ❺; ❶ WHOSTEDIT: Open a new Enhanced Editor window. ❷ INCLUDE: Load the specified SAS program into the Enhanced Editor window. ❸ EDCMD SELECTALL: Select all code in the Enhanced Editor window. ❹ EDCMD COPY: Copy the selected code to the paste buffer. ❺ EDCMD WINCLOSE: Close the Enhanced Editor window. CONVERT TEXT TO RTF Once the SAS program is available in the clipboard a new Word document is created and the code is inserted. The rich text elements from the Enhanced Editor are still available in the clipboard and are carried over into the Word / RTF document. DDE technology is used to start Windows Word and to communicate between SAS and the Word application. Page 2 of 5

x insert pathname here\winword.exe ; ❶ filename worddoc dde 'WinWord System'; data _null_; file worddoc; *** copy the program to Word; ❷ put '[StartOfDocument]'; put '[EditPaste]'; *** change font size; ❸ put '[EditSelectAll]'; put '[FontSize 8]'; *** change page margins; put "[FilePageSetup.LeftMargin = ""1IN""]"; put "[FilePageSetup.RightMargin = ""1IN""]"; *** print document to PS file; ❹ put "[FilePrint" ".PrintToFile=1, " ".PrToFileName=""insert Postscript filename here"", " ".OutputPrinter=""insert name of Postscript printer driver here""]"; put '[FileCloseAll 2]'; ❺ put '[AppClose]'; run; filename worddoc clear; ❶: Microsoft Word is started using the X command and the Dynamic Data Exchange (DDE) channel is opened between SAS and the application in the filename statement. ❷: Visual Basic commands are sent through the DDE channel to create a new document and to paste the SAS code from the clipboard into the new document. ❸: Font size and margins are customized. ❹: The file is sent to a Postscript printer device. The PrintToFile= 1 command is responsible that a PS file is created instead of a printed paper copy. ❺: Close all open files and end the Word application. Page 3 of 5

Changing font size and margins are just examples of customization that can be done once the Word/RTF document is available. The document metadata, header and footer information can be changed in a similar way. CONVERT RTF TO PDF There are many ways to convert the Word/RTF file to PDF. In this example the document in printed to a Postscript (PS) file and the PS file is then converted to PDF. Many printer drivers offer PS support and can be used for printing (see section ❹ of code above). The popular freeware tool Ghostscript can then be used for conversion of the PS file to PDF. Of course there is also the option of creating a PDF file directly from the RTF file, i.e. by using the full version of Adobe Acrobat. In our case the intermediate step of creating a PS file was chosen to have the option of adding PDFMARK language in the conversion process. PDFMARK language can be used to add elements like bookmarks, annotations, or file properties (e.g. author) to the PDF document. By choosing this approach it would be possible to accumulate multiple programs in one PDF document with bookmarks pointing to the individual programs and thus creating a SAS program library in PDF for documentation purposes. The bookmarks could be generated using the PDFMARK language. An example how PDFMARK language is used can be found in the PharmaSUG 2003 paper Using RTF, EPS, PDFMARK to Automate the Creation of Your DEFINE.PDF Document for Electronic Submissions [3]. HARD AND SOFTWARE REQUIREMENTS SAS version 9.1 under Windows 2003 was used together with the DDE interface to Windows applications. The Enhanced Editor is available for Windows SAS beginning in Version 8. Microsoft Word 2003 was used for processing the RTF document. Ghostscript installed under Windows was used for the conversion from Postscript to PDF. The process described in this paper was developed under Windows SAS Version 9.1. At the time this paper was conceived the authors did not have the opportunity to work with SAS Version 9.2. Since the functionality of saving LOG files in RTF format is already available it could very well be that SAS programs can be saved in RTF format as well in a SAS version beyond version 9.1. CONCLUSION If SAS programs are needed as PDF files it is a nice add-on to have color coded code. This paper presents a method for automatic conversion of SAS programs into PDF while keeping the color coded features from the SAS Enhanced Editor. Implementing the presented solution was not as easy as initially thought because of the poorly documented SELECTALL DM command, which could not be found in the SAS help but was hidden in the SAS usage notes. DDE may not be the latest technology however it still works well and may be a good solution for SAS programmers with only SAS BASE available. In SAS 9.1 there is a feature to save LOG files in RTF. It would be nice if SAS provided the same functionality for the Enhanced Editor. Page 4 of 5

REFERENCES 1. Electronic Common Technical Document (ectd): Study Data Specifications (8/7/2007) (http://www.fda.gov/downloads/drugs/developmentapprovalprocess/formssubmissionrequirem ents/electronicsubmissions/ucm163561.pdf) 2. SAS Usage Note 13800: How to programmatically mark and copy all text in Enhanced Editor (http://support.sas.com/kb/13/800.html) 3. Using RTF, EPS, PDFMARK to Automate the Creation of Your DEFINE.PDF Document for Electronic Submissions, Dirk Spruck, PharmaSUG 2003 (http://www.lexjansen.com/pharmasug/2003/fdacompliance/fda077.pdf) ACKNOWLEDGMENTS We would like to thank our colleagues/former colleagues at Accovion for their support. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the authors at: Dirk Spruck Accovion Softwarecenter 3 35037 Marburg Work Phone: +49 6421 9484937 Fax: +49 6421 9484961 Email: dirk.spruck@accovion.com Piia-Piret Eomois German Cancer Research Center Im Neuenheimer Feld 280 69120 Heidelberg Work Phone: +49 6221 422215 Fax: +49 6221 422203 Email: p.eomois@dkfz.de Brand and product names are trademarks of their respective companies. Page 5 of 5