<?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: How to concatenate all datasets in json library  as per Json model schema in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920105#M362394</link>
    <description>&lt;P&gt;Do you really mean concatenate, or do you want the result of a join? I'd expect something like this would fit the bill:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select id, r.name, city, age, f.name, hobbies1, hobbies2, hobbies3  
	from apijson.root as r
	left join 
		  apijson.friends as f
		on r.ordinal_root=f.ordinal_root
	left join 
	  apijson.Friends_hobbies as h
		on h.ordinal_friends=f.ordinal_friends
	order by ID
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure SQL: Query Results" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;id&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;name&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;city&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;age&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;name&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;hobbies1&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;hobbies2&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;hobbies3&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="l data"&gt;Nora&lt;/TD&gt;
&lt;TD class="l data"&gt;New Orleans&lt;/TD&gt;
&lt;TD class="r data"&gt;55&lt;/TD&gt;
&lt;TD class="l data"&gt;Lucas&lt;/TD&gt;
&lt;TD class="l data"&gt;Yoga&lt;/TD&gt;
&lt;TD class="l data"&gt;Playing Cards&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="l data"&gt;Nora&lt;/TD&gt;
&lt;TD class="l data"&gt;New Orleans&lt;/TD&gt;
&lt;TD class="r data"&gt;55&lt;/TD&gt;
&lt;TD class="l data"&gt;Emma&lt;/TD&gt;
&lt;TD class="l data"&gt;Calligraphy&lt;/TD&gt;
&lt;TD class="l data"&gt;Television&lt;/TD&gt;
&lt;TD class="l data"&gt;Music&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="l data"&gt;Mia&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 13 Mar 2024 12:00:03 GMT</pubDate>
    <dc:creator>SASJedi</dc:creator>
    <dc:date>2024-03-13T12:00:03Z</dc:date>
    <item>
      <title>How to concatenate all datasets in json library  as per Json model schema</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920088#M362392</link>
      <description>&lt;P&gt;Hello Team,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;am reading data from Json file , where its contents are dynamic&amp;nbsp; as shown in below format&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the first record has all attributes , where as second record has only few attributes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[
  {
    "id": 0,
    "name": "Nora",
    "city": "New Orleans",
    "age": 55,
    "friends": [
      {
        "name": "Emma",
        "hobbies": [ "Calligraphy", "Television", "Music" ]
      },
      {
        "name": "Lucas",
        "hobbies": [ "Yoga", "Playing Cards" ]
      }
    ]
  },
  {
    "id": 1,
    "name": "Mia",
  },
  
]&lt;/PRE&gt;
&lt;PRE&gt;	libname APIJSON JSON fileref=jsonout;

	proc datasets lib=APIJSON; quit;&lt;/PRE&gt;
&lt;P&gt;i would like to concatenate all datasets in json library&amp;nbsp; as per Json model schema and load null values for optional attributes or data sets&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this example , friends data set is optional and&amp;nbsp;city , age attributes are optional&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 10:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920088#M362392</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-03-13T10:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate all datasets in json library  as per Json model schema</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920105#M362394</link>
      <description>&lt;P&gt;Do you really mean concatenate, or do you want the result of a join? I'd expect something like this would fit the bill:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select id, r.name, city, age, f.name, hobbies1, hobbies2, hobbies3  
	from apijson.root as r
	left join 
		  apijson.friends as f
		on r.ordinal_root=f.ordinal_root
	left join 
	  apijson.Friends_hobbies as h
		on h.ordinal_friends=f.ordinal_friends
	order by ID
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure SQL: Query Results" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;id&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;name&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;city&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;age&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;name&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;hobbies1&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;hobbies2&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;hobbies3&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="l data"&gt;Nora&lt;/TD&gt;
&lt;TD class="l data"&gt;New Orleans&lt;/TD&gt;
&lt;TD class="r data"&gt;55&lt;/TD&gt;
&lt;TD class="l data"&gt;Lucas&lt;/TD&gt;
&lt;TD class="l data"&gt;Yoga&lt;/TD&gt;
&lt;TD class="l data"&gt;Playing Cards&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="l data"&gt;Nora&lt;/TD&gt;
&lt;TD class="l data"&gt;New Orleans&lt;/TD&gt;
&lt;TD class="r data"&gt;55&lt;/TD&gt;
&lt;TD class="l data"&gt;Emma&lt;/TD&gt;
&lt;TD class="l data"&gt;Calligraphy&lt;/TD&gt;
&lt;TD class="l data"&gt;Television&lt;/TD&gt;
&lt;TD class="l data"&gt;Music&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="l data"&gt;Mia&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 13 Mar 2024 12:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920105#M362394</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-03-13T12:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate all datasets in json library  as per Json model schema</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920118#M362399</link>
      <description>&lt;P&gt;as mentioned , the json attributes are dynamic like in this example&amp;nbsp;&lt;SPAN&gt;friends data set is dynamic&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 13:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920118#M362399</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-03-13T13:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate all datasets in json library  as per Json model schema</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920119#M362400</link>
      <description>which means for few records we will get friends data and for other records we wont't get as it is a optional field</description>
      <pubDate>Wed, 13 Mar 2024 13:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-all-datasets-in-json-library-as-per-Json/m-p/920119#M362400</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2024-03-13T13:31:59Z</dc:date>
    </item>
  </channel>
</rss>

