<?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 Re: Why does SAS/IML find conflicting item names in a list concatenation? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Why-does-SAS-IML-find-conflicting-item-names-in-a-list/m-p/770475#M5660</link>
    <description>&lt;P&gt;Named items are used to emulate associative arrays. An associative array is a collection of (key, value) pairs where each key appears at most once. Notice that the VALUES can be repeated, but each key must be unique.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why should names be unique? Because when you ask for&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;x&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function keyword"&gt;ListGetItem&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;L&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;'joe'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;you want to get ONE item, the one named 'joe'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your program is complicated. A simpler example is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;L = [#MyKey=1, #MyKey=2];&lt;/P&gt;
&lt;P&gt;which gives the error&lt;BR /&gt;&lt;STRONG&gt;ERROR:&lt;/STRONG&gt; The name MyKey conflicts with an existing name used in the list.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Sep 2021 10:30:18 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2021-09-26T10:30:18Z</dc:date>
    <item>
      <title>Why does SAS/IML find conflicting item names in a list concatenation?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Why-does-SAS-IML-find-conflicting-item-names-in-a-list/m-p/770442#M5659</link>
      <description>&lt;P&gt;I want to build a list containing multiple subitems at the same level so that I have what is equivalent to an array of lists. The code is:&lt;/P&gt;
&lt;PRE style="position: fixed; left: -1000px;"&gt;proc iml ; package load listutil ;&lt;BR /&gt;L = [] ;&lt;BR /&gt;L = L || [ #'1'=[] ] ;&lt;BR /&gt;L$1 = [ #'1.1'=[] ] ;&lt;BR /&gt;call listprint( L$'1'$'1.1' ) ;&lt;BR /&gt;L$1 = L$1 || [ 1, #index=1 ] ;&lt;BR /&gt;L$1 = L$1 || [ 2, #index=2 ] ;&lt;BR /&gt;L$1 = L$1 || [ 2, #index2=2 ] ;&lt;BR /&gt;call struct(L) ;&lt;BR /&gt;quit ;&lt;/PRE&gt;
&lt;PRE style="position: fixed; left: -1000px;"&gt;proc iml ; package load listutil ;&lt;BR /&gt;L = [] ;&lt;BR /&gt;L = L || [ #'1'=[] ] ;&lt;BR /&gt;L$1 = [ #'1.1'=[] ] ;&lt;BR /&gt;call listprint( L$'1'$'1.1' ) ;&lt;BR /&gt;L$1 = L$1 || [ 1, #index=1 ] ;&lt;BR /&gt;L$1 = L$1 || [ 2, #index=2 ] ;&lt;BR /&gt;L$1 = L$1 || [ 2, #index2=2 ] ;&lt;BR /&gt;call struct(L) ;&lt;BR /&gt;quit ;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml ; package load listutil ;
L = [] ;
L = L || [ #'1'=[] ] ;
L$1 = [ #'1.1'=[] ] ;
call listprint( L$'1'$'1.1' ) ;
L$1 = L$1 || [ 1, #index=1 ] ;
L$1 = L$1 || [ 2, #index=2 ] ;
L$1 = L$1 || [ 2, #index2=2 ] ;
L$1 = L$1 || [ 2, 3 ] ;
L$1 = L$1 || [ 2, 3 ] ;
call struct(L) ;
quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log displays an error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;72 L = [] ;
73 L = L || [ #'1'=[] ] ;
74 L$1 = [ #'1.1'=[] ] ;
75 call listprint( L$'1'$'1.1' ) ;
76 L$1 = L$1 || [ 1, #index=1 ] ;
77 L$1 = L$1 || [ 2, #index=2 ] ;
ERROR: Conflicting item names were found in the list concatenation.

operation : || at line 77 column 11
operands : _TEM1001, _TEM1002

_TEM1001 3 items (list)

_TEM1002 2 items (list)

statement : ASSIGN at line 77 column 1
78 L$1 = L$1 || [ 2, #index2=2 ] ;
79 call struct(L) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;Note that the same operation in line 78 is acceptable even though the first item in the right argument to the concatenation operator, 2, is the same as the first item in the statement on line 77. The named items, 'index' and 'index2', are different. Furthermore, if the example is extended to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml ; package load listutil ;
L = [] ;
L = L || [ #'1'=[] ] ;
L$1 = [ #'1.1'=[] ] ;
call listprint( L$'1'$'1.1' ) ;
L$1 = L$1 || [ 1, #index=1 ] ;
L$1 = L$1 || [ 2, #index=2 ] ;
L$1 = L$1 || [ 2, #index2=2 ] ;
L$1 = L$1 || [ 2, 3 ] ;
L$1 = L$1 || [ 2, 3 ] ;
call struct(L) ;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then we will observe that the last two concatenations are accepted even though the items [ 2, 3 ] are identical. Why are identical numeric arguments accepted for list items but named items are required to be distinguished?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 23:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Why-does-SAS-IML-find-conflicting-item-names-in-a-list/m-p/770442#M5659</guid>
      <dc:creator>rbettinger</dc:creator>
      <dc:date>2021-09-25T23:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why does SAS/IML find conflicting item names in a list concatenation?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Why-does-SAS-IML-find-conflicting-item-names-in-a-list/m-p/770475#M5660</link>
      <description>&lt;P&gt;Named items are used to emulate associative arrays. An associative array is a collection of (key, value) pairs where each key appears at most once. Notice that the VALUES can be repeated, but each key must be unique.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why should names be unique? Because when you ask for&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;x&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function keyword"&gt;ListGetItem&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;L&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;'joe'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;you want to get ONE item, the one named 'joe'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your program is complicated. A simpler example is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;L = [#MyKey=1, #MyKey=2];&lt;/P&gt;
&lt;P&gt;which gives the error&lt;BR /&gt;&lt;STRONG&gt;ERROR:&lt;/STRONG&gt; The name MyKey conflicts with an existing name used in the list.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 10:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Why-does-SAS-IML-find-conflicting-item-names-in-a-list/m-p/770475#M5660</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-09-26T10:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why does SAS/IML find conflicting item names in a list concatenation?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Why-does-SAS-IML-find-conflicting-item-names-in-a-list/m-p/770499#M5661</link>
      <description>&lt;P&gt;Thank you, Rick! I didn't expect to get a reply so soon, since it is Sunday morning, but your response came as a pleasant surprise &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 13:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Why-does-SAS-IML-find-conflicting-item-names-in-a-list/m-p/770499#M5661</guid>
      <dc:creator>rbettinger</dc:creator>
      <dc:date>2021-09-26T13:35:34Z</dc:date>
    </item>
  </channel>
</rss>

