BookmarkSubscribeRSS Feed
hollandnumerics
Pyrite | Level 9

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
7 REPLIES 7
Tim_SAS
Barite | Level 11

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.

hollandnumerics
Pyrite | Level 9

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
Tim_SAS
Barite | Level 11

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.

hollandnumerics
Pyrite | Level 9

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
hollandnumerics
Pyrite | Level 9

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
Tim_SAS
Barite | Level 11

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.

Tim_SAS
Barite | Level 11

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 1369 views
  • 3 likes
  • 2 in conversation