BookmarkSubscribeRSS Feed
MarcTC
Obsidian | Level 7
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
8 REPLIES 8
Cynthia_sas
SAS Super FREQ
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
MarcTC
Obsidian | Level 7
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?
Cynthia_sas
SAS Super FREQ
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]
MarcTC
Obsidian | Level 7
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)?
Tim_SAS
Barite | Level 11
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]
MarcTC
Obsidian | Level 7
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.
Cynthia_sas
SAS Super FREQ
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
Ksharp
Super User
Just as Cynthia said.If you have installed Adobe software,then you can open
external html file to print it as pdf file.

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
  • 8 replies
  • 1252 views
  • 0 likes
  • 4 in conversation