The SAS Output Delivery System and reporting techniques

How do you create a tagset that writes multiple files to a zip file?

Reply
Contributor
Posts: 41

How do you create a tagset that writes multiple files to a zip file?

In the absence of anything suitable already available on the SAS web site, I've started working on an ODS tagset to create OpenDocument spreadsheets.  The final file is a zip file with a suffix of ".ods" containing a number of files:

  • content.xml
  • styles.xml
  • settings.xml
  • meta.xml
  • META-INF/manifest.xml

I know how to create a zip file using DEFINE PACKAGE, but how do you direct specific bits of XML into different files from a single template?

I'd like to have a look inside the OOXML templates, but I've not yet installed 9.4M1.

Thanks in advance.............Phil

Philip R Holland
Holland Numerics: Blog and Forums
http://blog.hollandnumerics.org.uk
Super Contributor
Posts: 394

Re: How do you create a tagset that writes multiple files to a zip file?

Posted in reply to hollandnumerics

I know how to create a zip file using DEFINE PACKAGE, but how do you direct specific bits of XML into different files from a single template?

As long as you need no more than 7 distinct files, you can use the FILE= attribute on the DEFINE EVENT statement to direct the output to one of the predefined output files. Specify the file name with the corresponding option on the ODS MARKUP statement. Search for FILE= in htmltags.tpl (for example) to see it used.

Contributor
Posts: 41

Re: How do you create a tagset that writes multiple files to a zip file?

Tim,

I searched for htmltags.tpl on support.sas.com, and also looked in my SAS 9.4 installation, but couldn't find this template.  Do you have a link to where I can download it, or should I just wait for my 9.4M1 download and installation to complete first?

.........Phil

Philip R Holland
Holland Numerics: Blog and Forums
http://blog.hollandnumerics.org.uk
Super Contributor
Posts: 394

Re: How do you create a tagset that writes multiple files to a zip file?

Posted in reply to hollandnumerics

It's part of the standard SAS install. Probably the easiest thing to do is to use SAS to view the phtml tagset.

  1. Start SAS with the -DMS option.
  2. Enter odstemplates in the command window.
  3. Click Sashelp.Tmplmst
  4. Click Tagsets
  5. Click Phtml
  6. Search for the contents_branch event handler, or for the string "file = CONTENTS".

There are several uses of the FILE attribute in that tagset.

Contributor
Posts: 41

Re: How do you create a tagset that writes multiple files to a zip file?

Tim,

I think I understand the FILE= parameter now, but how do you send XML into a zipped file that is not in the zip archive base folder, eg. META-INF/manifest.xml? I can write to files in the default folder which are cleared after writing to the zip file, but I need to create another file in a different folder inside the zip archive file.  Do you need to specify it in DEFINE PACKAGE?

.........Phil

PS. I'm struggling to find any documentation for TAGSET and PACKAGE together!

Philip R Holland
Holland Numerics: Blog and Forums
http://blog.hollandnumerics.org.uk
Contributor
Posts: 41

Re: How do you create a tagset that writes multiple files to a zip file?

Posted in reply to hollandnumerics

Tim,

I'm also getting an odd error message when I try to use a tagset with an associated package:

ERROR: Unknown BOOL attribute: QUIET.

.............Phil

Philip R Holland
Holland Numerics: Blog and Forums
http://blog.hollandnumerics.org.uk
Super Contributor
Posts: 394

Re: How do you create a tagset that writes multiple files to a zip file?

Posted in reply to hollandnumerics

I'm also getting an odd error message when I try to use a tagset with an associated package:

ERROR: Unknown BOOL attribute: QUIET.

No idea. It's probably a bug. Good question for tech support, though. They'll know or find out.

Super Contributor
Posts: 394

Re: How do you create a tagset that writes multiple files to a zip file?

Posted in reply to hollandnumerics

I think I understand the FILE= parameter now, but how do you send XML into a zipped file that is not in the zip archive base folder, eg. META-INF/manifest.xml? I can write to files in the default folder which are cleared after writing to the zip file, but I need to create another file in a different folder inside the zip archive file.  Do you need to specify it in DEFINE PACKAGE?

I'm not overly familiar with ODS PACKAGE, but I believe what you'd do is combine the FILE="manifest.xml" and PATH="META-INF" options.

PS. I'm struggling to find any documentation for TAGSET and PACKAGE together!

I don't think you'll find any. Maybe there's an SGF paper out there somewhere.

Ask a Question
Discussion stats
  • 7 replies
  • 617 views
  • 3 likes
  • 2 in conversation