I need to routinely generate a pdf file containing the program, log file, and output results. I am currently copy and past all of those in word and generate a pdf there. This is boring and tiring. I am wondering is someone has already had the code to automate it?
PDF format is a proprietary format -- meant to be opened with Adobe Acrobat Reader and meant to be created from either an Adobe product or a software application like SAS (ODS PDF).
ODS PDF will easily take your REPORT output or outputs (what would normally go to the LISTING window) and put it into a PDF file. However, due to the nature of PDF files, you cannot use SAS to combine 2 PDF files together. So, if you have REPORT1.PDF and REPORT2.PDF, you could not use SAS to combine them into 1 new PDF. That's because Adobe has file start and file end control commands in each file that make their combining with SAS virtually impossible to do.
However, with an Adobe product, you could combine REPORT1.PDF and REPORT2.PDF together.
The SAS program (.SAS) and the SAS log file (.LOG) (when saved to an external file) are just ASCII text files. There is no direct way to convert a program file or a log file to PDF format. However, you CAN read a .SAS or .LOG file into a SAS dataset and then, once in dataset format, you can write the file back out to ODS PDF form. The reason I mentioned about REPORT1.PDF and REPORT2.PDF up above, however, is the relevant point here. You would need for your program to be "finished" before you could grab your .LOG file -- so that means the while it is theoretically possible to have the report and .SAS file in one PDF file, your .LOG file would be in a second PDF file and you could not combine the two PDF files together with SAS -- you'd have to use either an Adobe product or a 3rd party product to combine the files together. So, if you were going to use an Adobe product or a 3rd party product, you might as well just create your report with ODS PDF and then use the 3rd party product to create 1 file of the .LOG and .SAS files along with the report PDF.
There have been several previous forum postings about printing the log to either RTF or PDF (or HTML) and/or printing the program to PDF. A search with the forum search facility should help you find those previous posts.