Hi:
Some forum hints...if you have a section of code or XML, where you want the indention to be respected, then put
squarebracket-pre-squarebracket and squarebracket-/pre-squarebracket around the code. As in
[pre]
#pre#
some code
indented code
more code
something else
the end
#/pre#
[/pre]
Except where I have the first #, you would use [ and where I have the second pre#, you would use pre] -- that's [ pre ] without any spaces before or after the pre.
Next, if you look carefully at my XML, you will see that my XML processing instruction is the <?xml version="1.0" encoding="windows-1252" ?>. Next, my enclosing ROOT tag is <TABLE> and </TABLE>. So the <MUPPET> tag encloses each SAS observation in a way that produces a well-formed XML file. If you needed the XML Libname Engine to write some information in a tag in a different way than it normally does (which is what I show), then you would have to alter the TAGSET template used by the XML Libname engine to produce the XML tags. What gets written out tag-wise and in what order is controlled by "events" in the tagset template and if you wanted to write tags out differently, you'd have to change the event handling in the tagset template.
I'm not sure that an XMLMap would help you, even in SAS 9.2, because you're producing XML that is non-standard, from the SAS standpoint -- SAS really wants for the end of the observation tag (in this case </MUPPET>) to be after the last var (column5) for every obs in the data set. If you need for different XML to be written For example, in the XML below, SAS would automatically write out the <ROOT> and <ROW> tags. If you wanted to write out the <TABLEA> and <TABLEB> tags, that also would be a tagset template change. You could write out the "subtext" tag either by making the text a variable value in the data set or by hardcoding the text to be written out as part of an event in the tagset template.
[pre]
bigbird
some text comment
yellow
happy
Sesame Street
Big Bird in China
|
[/pre]
If you look at some of the examples in this PharmaSUG paper, perhaps you'll get a better idea of how a tagset template can be customized to produce custom XML.
http://www.lexjansen.com/pharmasug/2006/technicaltechniques/tt24.pdf
cynthia