<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proc Template: numeric index value not being recognised? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Template-numeric-index-value-not-being-recognised/m-p/148156#M11502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a tagset for a specific export file. I am having some difficulties getting a 'loop' construct to work. Can someone tell me why this code works when I specifically assign the index value and why it does not work when using a variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; eval $loop 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; putlog $address_context[1];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this line produces the desired output namely the first item in my array */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; putlog $address_context[$loop];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this line produces nothing */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be very much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jan 2014 19:52:47 GMT</pubDate>
    <dc:creator>RMP</dc:creator>
    <dc:date>2014-01-21T19:52:47Z</dc:date>
    <item>
      <title>Proc Template: numeric index value not being recognised?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Template-numeric-index-value-not-being-recognised/m-p/148156#M11502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a tagset for a specific export file. I am having some difficulties getting a 'loop' construct to work. Can someone tell me why this code works when I specifically assign the index value and why it does not work when using a variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; eval $loop 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; putlog $address_context[1];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this line produces the desired output namely the first item in my array */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; putlog $address_context[$loop];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this line produces nothing */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be very much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 19:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Template-numeric-index-value-not-being-recognised/m-p/148156#M11502</guid>
      <dc:creator>RMP</dc:creator>
      <dc:date>2014-01-21T19:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Template: numeric index value not being recognised?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Template-numeric-index-value-not-being-recognised/m-p/148157#M11503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #1f497d; mso-bidi-font-family: 'Times New Roman';"&gt;I didn’t use PUT/PUTLOG the way you do in your TAGSET template. It sounds like you are designing a template for use with the SAS XML Libname engine, correct? Not for use with ODS? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; mso-bidi-font-family: 'Times New Roman';"&gt;&amp;nbsp; Mostly, I used PUTLOG and PUT to write out&amp;nbsp; quoted “pairs”, so for example…if I had PUT I used it sort of like they show in the doc…&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/odsug/66611/HTML/default/viewer.htm#n0luvkrmcfepfen1wmf0grk6vcbb.htm"&gt;http://support.sas.com/documentation/cdl/en/odsug/66611/HTML/default/viewer.htm#n0luvkrmcfepfen1wmf0grk6vcbb.htm&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where it says that&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; mso-bidi-font-family: 'Times New Roman';"&gt;If the variable does not have a value, then the text is not&amp;nbsp; written, and there is no output for the text or the variable. For example, for&lt;BR /&gt;the following PUT statement, if the variables BackGround, ForeGround, and CellPadding do not have values, then the output is &amp;lt;table&amp;gt; followed by a new line: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: 'Courier New';"&gt;&lt;STRONG&gt;put '&amp;lt;table' 'background=' background 'foreground=' foreground 'cellpadding=' cellpadding '&amp;gt;' nl;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; mso-bidi-font-family: 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; So I used PUT in the same way for writing out the attribute/value pairs easily to generate custom XML. If there WAS a value for the BACKGROUND attribute, then background=cx123456 would be&lt;BR /&gt;written, but if there was no value for background, then no part of the text string would be written. I found some old PROC TEMPLATE code that use a similar reference to what you show. The code I&lt;BR /&gt;found was in a DO/DONE block, but with a SET and $col_names[$index], which, as I remember resolved just fine, but it was not using the reference in a PUT&lt;BR /&gt;statement in PROC TEMPLATE:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New';"&gt;&lt;STRONG&gt;do /while $index &amp;lt;= $count;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set $name&amp;nbsp; $col_names[$index] ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set $value $col_values[$name] ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trigger EmitCol ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval $index $index+1;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New';"&gt;&lt;STRONG&gt;done;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; mso-bidi-font-family: 'Times New Roman';"&gt;&amp;nbsp; So I’m not sure what is different about PUT/PUTLOG…in your example, it is puzzling how it can find a value when the 1 is hard-coded, but not when the value is set to 1 and you use the internal variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; mso-bidi-font-family: 'Times New Roman';"&gt;&amp;nbsp; I think your best resource will be working with As far as I know, the only folks who write custom tagsets are in Tech Support or folks who use the XML Mapper to generate .map files for use with the XML Libname engine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; mso-bidi-font-family: 'Times New Roman';"&gt;cynthia&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; mso-bidi-font-family: 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 22:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Template-numeric-index-value-not-being-recognised/m-p/148157#M11503</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-01-21T22:43:08Z</dc:date>
    </item>
  </channel>
</rss>

