The SAS Output Delivery System and reporting techniques

ODS PDF

Reply
Frequent Contributor
Posts: 77

ODS PDF

Here is another ODS PDF question. I can't find a thread having an answer.

Suppose we have a form in pdf and it is currently filled out for each customer manually. If we customer data in sas dataset and want to automate this process, how to do this in ODS so that it can output the exact same form in pdf with customer information filled in by SAS. An form example here:

http://www.immunotec.com/IRL/Public/en/CAN/Forms_UK_CustOrder_10_07.pdf
SAS Super FREQ
Posts: 8,861

Re: ODS PDF

Hi:
Basically, there may not have been threads on the topic, but there have been user group papers on the subject...here are a few that I found with a Google search:
http://www2.sas.com/proceedings/sugi27/p032-27.pdf
http://www.lexjansen.com/pharmasug/2004/CodersCorner/CC02.pdf

I believe that to populate an Adobe Form, you need either an FDF file or an XDF file. It is my understanding that both file formats are XML-based. So that means you would need to translate your SAS dataset into whatever FDF or XDF "flavor" of XML you needed for your form.

When you talk about SAS And XML, in general, you are either talking about tagset templates and the SAS XML Libname Engine to convert SAS datasets to XML format or about ODS to create XML output from SAS reports. Also, since it has always been possible to create ASCII text files with the DATA step and FILE/PUT statements, you could write a DATA step program to create your flavor of XML (which is the topic of one of the papers).

But before you pick a method to create your XML file, first, you have to understand what your flavor of XML looks like. The SAS XML Libname Engine has a few pre-defined XML formats that it can create -- such as ORACLE "flavor" of XML -- but my guess is that the FDF or XDF XML is highly tied to a specific form and doesn't lend itself to a "pre-defined" specification.

To see what kind of XML the SAS XML Libname Engine can generate, run this program. It exports the first 3 obs from SASHELP.CLASS into 2 different types of XML:
[pre]
libname xmlout xml 'c:\temp\classout.xml';
libname oraout xml 'c:\temp\oraout.xml'
xmltype=oracle;

data xmlout.class
oraout.class;
set sashelp.class(obs=3);
run;

libname xmlout clear;
libname oraout clear;
[/pre]

The Adobe doc on the FDF format starts on page 671 of this document:
http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf and there is some info on XDF data here:
http://livedocs.adobe.com/livecycle/8.2/ddxRef/wwhelp/wwhimpl/common/html/wwhelp.htm?context=DDX&fil...

cynthia
Frequent Contributor
Posts: 77

Re: ODS PDF

Posted in reply to Cynthia_sas
Cynthia- Thank for the pointers.

Here is another simpler question.

If I just want to place two tables side by side in a pdf(i.e a pdf only contains two tables and these two tables are next to each other horizontally), how to do it?
SAS Super FREQ
Posts: 8,861

Re: ODS PDF

That is a much easier question than a question about XML!

Look in the doc and previous forums postings for the COLUMNS= option. A simple example is below.

cynthia
[pre]
ods listing close;
options orientation=portrait nodate nonumber
topmargin=.5in bottommargin=.5in
rightmargin=.5in leftmargin=.5in;

ods pdf file='c:\temp\twocol.pdf' columns=2;

proc print data=sashelp.class noobs;
where sex = 'M';
var name age height weight;
run;

proc print data=sashelp.class noobs;
where sex = 'F';
var name age height weight ;
run;

ods pdf close;
[/pre]
Frequent Contributor
Posts: 77

Re: ODS PDF

Posted in reply to Cynthia_sas
Thank again for the great answer!


Another tricky question:


Is it possible to use SAS to produce the report in HTML format and then convert it to PDF format(all of these are done by SAS)?
Super Contributor
Posts: 394

Re: ODS PDF

Just have SAS create the report in both formats simultaneously.

[pre]
ODS PDF FILE="my.pdf";
ODS HTML FILE="my.html";
/* stuff */
ODS PDF CLOSE;
ODS HTML CLOSE;
[/pre]
Frequent Contributor
Posts: 77

Re: ODS PDF

Tim's answer is not what I am looking for.


Suppose I have an external html file, I want to know if it is possible to read it into SAS and convert and output to a pdf file.
SAS Super FREQ
Posts: 8,861

Re: ODS PDF

If you had a 3rd party product that could "distill" or convert an HTML file to PDF form, you could use an X command from a SAS program to convert from HTML to PDF by issuing the command line for the 3rd party application. Of course, you could run the program in batch mode from a DOS prompt, too. So SAS wouldn't bring much to the party in this regard.

Otherwise, while you -might- read the HTML file with SAS, you would have to convert the HTML file's information to a SAS dataset in order to use ODS to create a PDF file. This means that the PDF output might not look like a distilled version of the original HTML page.

Can you explain a bit more about what's in the HTML file and how you would envision the part that SAS would play in performing the conversion -- would SAS just be an alternative to issuing a DOS command? Are you trying to avoid using Adobe Acrobat or Acrobat Distiller???

cynthia
Super User
Posts: 10,018

Re: ODS PDF

Just as Cynthia said.If you have installed Adobe software,then you can open
external html file to print it as pdf file.
Ask a Question
Discussion stats
  • 8 replies
  • 230 views
  • 0 likes
  • 4 in conversation