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
SAS Super FREQ
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

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, 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
  • 2 replies
  • 708 views
  • 0 likes
  • 2 in conversation