Running SAS 9.1.3.
Trying to create a set of customized tagsets.
I am facing a strange behaviour with the event initialize.
When using the proc print, I can see that the initialize event is ran several times with the side effect that the memory variables populated during the tagset execution are being cancelled, if I am using the XML engine in data step I don't have the problem.
Here is the code, if you have any idea about it is welcome otherwise I will ask a defect id with tech support.
You may want to work with Tech Support on this issue. The various events, such as TABLE_BODY and DATA and DOC_BODY and DOC_HEAD, etc are triggered by SAS and when the event is sent to the open destinations it is the destination that handles the DEFINE EVENT block.
I would expect PROC PRINT to definitely trigger the different events than the events triggered by the LIBNAME engine. Therefore, I would EXPECT you to get different results when you used PROC PRINT with this tagset template versus when you used the LIBNAME engine. So I'm confused -- do you want a TAGSET template to use with ODS or to use with the LIBNAME engine???
In my paper for PharmaSUG a few years ago, I showed the use of a "custom" tagset template that would work for either the LIBNAME engine or the SAS procedures. I got the "custom" template from the developers and at one time, they were talking about rollling some version of the custom tagset out in the item store, but that was NOT true in SAS 9.1.3 -- you needed to get a copy of the custom tagset template in order to replicate the programs in my paper: http://www.lexjansen.com/pharmasug/2006/technicaltechniques/tt24.pdf
Also, you use _WEBOUT as the LIBREF and FILEREF and, generally, speaking, this is a bad idea because in some configurations (such as SAS/IntrNet and the BI Platform) _WEBOUT is a reserved file reference for capturing output.
Perhaps you could explain a bit about what you want your TAGSET template to do and whether you want to use it with the LIBNAME engine or ODS. Also, whether you have used the EVENT_MAP tagset to trace what events your procedure of interest might be using. An example of the EVENT_MAP tagset is shown below. If you examing the 2 output files, you will see the "map" of all the events that were triggered by each SAS process.
In order to learn about the events that are triggered when you use the SAS XML Libname Engine (SXLE) in SAS 9.1.3, you have to look at the tagset templates that all start with "SAS" in the template item store. These tagset templates, such as SASIO, SASXMOG, etc will use DIFFERENT events than the events used by the procedures when output is routed to ODS. So your final tagset template will need to be tailored accordingly.
Here are my comments.
I am using _WEBOUT as a filename for testing because the tagsets I am creating aim to be used in a STP context.
The doc has been tested in SAS913 and in SAS92.
I know that the base events are being generated by the engine or the proc.
My problem is to understand the behaviour of the EVENT INITIALIZE.
From my tests I can figure out that the INITIALIZE EVENT is being fired several times in the processing of the proc print. I am having troubles with this, I was expecting to get it triggered once at the beginning of the proc print.
I think it explains why when I am running the section : FINISH: of the TABLE_BODY event I do have my memory variables available anymore.
That -is- very odd. (That you are seeing initialize fire more than 1 time with PROC PRINT). When I test your TAGSET.TEST2 with PROC PRINT, I only see INITIALIZE being triggered once. Here's the output I get:
The tagset code I'm using is the same as your code, exactly the same as your code, and the output I'm getting is shown above. The invocation code is:
Even when I added BY group processing to the PROC PRINT, I only saw INITIALIZE getting triggered 1 time. When I used BY with NEWFILE, I still saw INITIALIZE only get triggered 1 time. So, it's a puzzle.
Since you do plan to use this TAGSET template for a Stored Process, it's probably best that you work with Tech Support. They can look at your exact code and your plans for the stored process and give you the best advice.