BookmarkSubscribeRSS Feed
hari1109
Fluorite | Level 6
Hi all,

Thank you in Advance.
I am ceating a customized tagset to generate xml output which is as follows




















In the above code Object count = 1 i am using a default value 1 for the row count, i tried to increment the count value other than the default value but it didn't work.
I am using the below proc template to generate the above xml :
Further is there any way to reference the destination file path in the xml.
2 REPLIES 2
hari1109
Fluorite | Level 6
code i am using to generate xml :


define event EmitMeta;
start:
put '<' $LIBRARYNAME '>' CR CR ;
putq '<' "Header Version =" '"' 1.0 '"' ' ' "Datecreated=" DATE ' ' "Timecreated=" TIME ' ' "Author=" AUTHOR "Comments=" nl nl;
putq '<' "Knowledgeobjects count=" '"' 1 '"' '>' nl;
put ' ' '<' "Knowledgeobjects" '>' nl ;
put ' ' '<' "KnowledgeDocuments Count=" '"' 1 '"' '>' nl;
putq ' ' '<' "Knowledge Document Doc Ref=" nl;
put ' ' '' nl nl;
break;
finish:
put ' ' '' nl ;
put ' ' '' nl ;
put '' ;
break;
end;

define event EmitRow;
ndent;
putq '' nl ;
ndent;

eval $index 1;
iterate $col_names ;
do /while _value_;
set $name _value_ ; trigger EmitCol;
next $col_names;
eval $index $index+1;
done;

xdent;
put "
" nl nl;
xdent;
break;
end;

define event EmitCol;
unset $value;
set $value $col_values[$name];
putq '' nl ;
break;
end;


Thank you.
Cynthia_sas
Diamond | Level 26
Hi:
I am guessing that the code snippet we see is not the complete code you are using. When any code you post has < or > symbols, the forum posting software frequently truncates the post because it tries to interpret the < and > as HTML tags.

The way around it is to use &lt; or &gt; (ampersand-lt-semicolon or ampersand-gt-semicolon) for purposes of posting the code.

However, before you go to all that effort to modify your code, your best bet is to open a ticket with Tech Support and provide them information or code about:
1) how are you invoking the tagset template: SAS XML Libname Engine or as ODS TAGSETS.?????? invocation. The method by which you invoke the tagset template does make a difference because the events could be different if generated for procedure output versus generated for data.

2) provide them with a sample copy of the SAS data set which is input to your process

3) provide them with a good copy of the XML you need to replicate

4) provide them the code you plan/want to use to invoke the tagset template.

I believe the solution for the counter issue will depend on how your count gets incremented. It will depend on where the incrementing is happening - -if it happens within the tagset template process, then you will need an event to trigger the incrementing of the variable. If it happens within a DATA step program, then you will likely need to retain the counter variable across iterations of the DATA step.

Tech Support is your best resource for help on this front.

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1169 views
  • 0 likes
  • 2 in conversation