<?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: nested list to represent data structure in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866714#M26241</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs;
input id $	parent $	n;
idx=length(id);
have=catx(' ',id,n,'records');
cards;
G	 .	100
G1	G	60
G11	G1	40
G12	G1	20
G2	G	10
G21	G2	10
G3	G	30
G31	G3	10
G32	G3	5
G33	G3	15
;


proc report data=have nowd noheader style={frame=void rules=none};
column idx have;
define idx/display noprint;
compute have;
if idx=2 then call define(_col_,'style','style={indent=0.25in}');
if idx=3 then call define(_col_,'style','style={indent=0.5in}');
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1680006946541.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82118iF0D7A888247FB35F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1680006946541.png" alt="Ksharp_0-1680006946541.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 12:36:09 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2023-03-28T12:36:09Z</dc:date>
    <item>
      <title>nested list to represent data structure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866703#M26238</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;in my work I often would like to report the data structure as a tree with nodes and subnodes.&lt;/P&gt;
&lt;P&gt;I recently discovered odslist that seems to have the capacity to present information as a nested list.&lt;/P&gt;
&lt;P&gt;for instance I can represent my data in a parent child structure as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" style="height: 14.5pt; width: 48pt;"&gt;id&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;parent&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;n&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right"&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G1&lt;/TD&gt;
&lt;TD&gt;G&lt;/TD&gt;
&lt;TD align="right"&gt;60&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G11&lt;/TD&gt;
&lt;TD&gt;G1&lt;/TD&gt;
&lt;TD align="right"&gt;40&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G12&lt;/TD&gt;
&lt;TD&gt;G1&lt;/TD&gt;
&lt;TD align="right"&gt;20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G2&lt;/TD&gt;
&lt;TD&gt;G&lt;/TD&gt;
&lt;TD align="right"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G21&lt;/TD&gt;
&lt;TD&gt;G2&lt;/TD&gt;
&lt;TD align="right"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G3&lt;/TD&gt;
&lt;TD&gt;G&lt;/TD&gt;
&lt;TD align="right"&gt;30&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G31&lt;/TD&gt;
&lt;TD&gt;G3&lt;/TD&gt;
&lt;TD align="right"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G32&lt;/TD&gt;
&lt;TD&gt;G3&lt;/TD&gt;
&lt;TD align="right"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" style="height: 14.5pt;"&gt;G33&lt;/TD&gt;
&lt;TD&gt;G3&lt;/TD&gt;
&lt;TD align="right"&gt;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and I would like to represent tham in the following way:&lt;/P&gt;
&lt;P&gt;G 100 records&lt;/P&gt;
&lt;P&gt;&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; G1 60 records&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G11 40 records&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G12 20 records&lt;/P&gt;
&lt;P&gt;&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; G2 10 records&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G21 10 records&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; G3 30 records&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G31 10 records&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G32 5 records&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G33 15 records&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible with odslist? any suggestion and especially code is very appreciated.&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 10:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866703#M26238</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2023-03-28T10:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: nested list to represent data structure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866707#M26240</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114"&gt;@ciro&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recently discovered odslist that seems to have the capacity to present information as a nested list.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you look at the documentation for PROC ODSLIST, you see this example:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsproc/n12euaqcj8y301n1iyyr2yjucbb2.htm" target="_self"&gt;Example 2: Creating Nested Lists&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 11:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866707#M26240</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-28T11:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: nested list to represent data structure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866714#M26241</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs;
input id $	parent $	n;
idx=length(id);
have=catx(' ',id,n,'records');
cards;
G	 .	100
G1	G	60
G11	G1	40
G12	G1	20
G2	G	10
G21	G2	10
G3	G	30
G31	G3	10
G32	G3	5
G33	G3	15
;


proc report data=have nowd noheader style={frame=void rules=none};
column idx have;
define idx/display noprint;
compute have;
if idx=2 then call define(_col_,'style','style={indent=0.25in}');
if idx=3 then call define(_col_,'style','style={indent=0.5in}');
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1680006946541.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82118iF0D7A888247FB35F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1680006946541.png" alt="Ksharp_0-1680006946541.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 12:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866714#M26241</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-03-28T12:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: nested list to represent data structure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866715#M26242</link>
      <description>&lt;P&gt;dear Paige,&lt;/P&gt;
&lt;P&gt;thank you for your answer.&lt;/P&gt;
&lt;P&gt;I had read that example and others, but my problem is a bit different, I think as the sublists and level of&amp;nbsp;&lt;/P&gt;
&lt;P&gt;indentation have to be initiated according to some conditions.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 12:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866715#M26242</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2023-03-28T12:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: nested list to represent data structure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866927#M26245</link>
      <description>&lt;P&gt;Thank you Ksharp. Very interesting solution. I learnt a new possibility.&lt;/P&gt;
&lt;P&gt;I'd like to wait a little more for an odslist solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 08:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/nested-list-to-represent-data-structure/m-p/866927#M26245</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2023-03-29T08:22:08Z</dc:date>
    </item>
  </channel>
</rss>

