<?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 can I create a nested value to be used with PROC JSON? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-nested-value-to-be-used-with-PROC-JSON/m-p/718611#M222414</link>
    <description>&lt;P&gt;Since you are new to SAS may I say welcome to the SAS Communities. May I suggest you look at the &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=p06hstivs0b3hsn1cb4zclxukkut.htm&amp;amp;locale=en" target="_self"&gt;JSON procedure&lt;/A&gt; for producing the JSON file. I assume that will be available to you in DI Studio. I have not used DI Studio.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will take some extra work to produce the hierarchical JSON file with the JSON procedure. Since you did not post the data set from which you are creating the JSON, I cannot give you a working example creating the JSON file. I suggest you take a look at the following posts to get an idea of how this can be done with the JSON procedure:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717112#M1122" target="_blank"&gt;https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717112#M1122&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Canada-Discussion-Forum/Formattting-JSON/m-p/688562#M224" target="_blank"&gt;https://communities.sas.com/t5/SAS-Canada-Discussion-Forum/Formattting-JSON/m-p/688562#M224&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2021 14:28:40 GMT</pubDate>
    <dc:creator>BillM_SAS</dc:creator>
    <dc:date>2021-02-11T14:28:40Z</dc:date>
    <item>
      <title>How can I create a nested value to be used with PROC JSON?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-nested-value-to-be-used-with-PROC-JSON/m-p/718554#M222402</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New SAS user and beginner programmer in general, so this may be a very basic question and the terminology might be a bit off. I am currently trying to create a JSON file which is going to be posted to an API. This is all done within DI Studio. A new requirement to the JSON-file format have me somewhat confused as to what the best solution would be. Below is a sample of the desired output of the JSON file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"Store":&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"StoreCode":"Aldi"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/STRONG&gt;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"Date": "2021-02-08",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"CustomerCount": 11000,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"CustomerSpending": 800&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue for me is creating this "nested" key-value pair ("StoreCode":"Aldi") part which is highlighted in Bold. Currently I've tried to work around this using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;substr(compress('{"StoreCode": ' || '"' || Store|| '"' || '}'), 1, 25)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is obviously not a good solution as this will come through as a string. Is there a way for SAS to create nested key-value pairs like in the sample above?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 12:16:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-nested-value-to-be-used-with-PROC-JSON/m-p/718554#M222402</guid>
      <dc:creator>larsc</dc:creator>
      <dc:date>2021-02-11T12:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a nested value to be used with PROC JSON?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-nested-value-to-be-used-with-PROC-JSON/m-p/718611#M222414</link>
      <description>&lt;P&gt;Since you are new to SAS may I say welcome to the SAS Communities. May I suggest you look at the &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=p06hstivs0b3hsn1cb4zclxukkut.htm&amp;amp;locale=en" target="_self"&gt;JSON procedure&lt;/A&gt; for producing the JSON file. I assume that will be available to you in DI Studio. I have not used DI Studio.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will take some extra work to produce the hierarchical JSON file with the JSON procedure. Since you did not post the data set from which you are creating the JSON, I cannot give you a working example creating the JSON file. I suggest you take a look at the following posts to get an idea of how this can be done with the JSON procedure:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717112#M1122" target="_blank"&gt;https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717112#M1122&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Canada-Discussion-Forum/Formattting-JSON/m-p/688562#M224" target="_blank"&gt;https://communities.sas.com/t5/SAS-Canada-Discussion-Forum/Formattting-JSON/m-p/688562#M224&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 14:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-nested-value-to-be-used-with-PROC-JSON/m-p/718611#M222414</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-02-11T14:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a nested value to be used with PROC JSON?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-nested-value-to-be-used-with-PROC-JSON/m-p/718835#M222507</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3480"&gt;@BillM_SAS&lt;/a&gt;, worked like a charm&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 09:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-nested-value-to-be-used-with-PROC-JSON/m-p/718835#M222507</guid>
      <dc:creator>larsc</dc:creator>
      <dc:date>2021-02-12T09:53:27Z</dc:date>
    </item>
  </channel>
</rss>

