<?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>BillM_SAS Tracker</title>
    <link>https://communities.sas.com/kntur85557/tracker</link>
    <description>BillM_SAS Tracker</description>
    <pubDate>Wed, 06 May 2026 01:40:15 GMT</pubDate>
    <dc:date>2026-05-06T01:40:15Z</dc:date>
    <item>
      <title>Re: Need help to create a hierarchical JSON file using PROC JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-create-a-hierarchical-JSON-file-using-PROC-JSON/m-p/843140#M333356</link>
      <description>&lt;P&gt;To use the POC SAS program, the easiest thing to do would be to create a new SAS data set from the dozen data sets you are currently using. In this new data set, put the data you want to output in JSON. Build this data set so that it has the same type of layout as the SASHELP.shoes data set (used to drive the POC SAS program). By that, I mean that each observation should contain all the data representing the levels of the hierarchy. So basically, you would take the dozen current data set and unnormalize them into a single data set. Once in a single data set, you should be able to modify the POC SAS program to accommodate your data to produce the JSON output desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other alternative is to use the technique demonstrated in the POC SAS program - identifying the hierarchy keys and using the keys to subset the data into hierarchy specific data sets. If your data is already normalized, I think it should be possible to modify the POC SAS program to produce the desired JSON output with your current data sets.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 14:45:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-create-a-hierarchical-JSON-file-using-PROC-JSON/m-p/843140#M333356</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-11-08T14:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to create a hierarchical JSON file using PROC JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-create-a-hierarchical-JSON-file-using-PROC-JSON/m-p/842990#M333320</link>
      <description>&lt;P&gt;I am confused by your question. All the data in the JSON output file is generated dynamically. The colored JSON you are referencing looks a little like what should be in the generated JSON procedure code that the proof-of-concept (POC) SAS program produces. The generated JSON procedure code is generated dynamically by the POC SAS program from whatever is in the SAS data set (in the POC case, SASHELP.shoes). All that the POC SAS program needs are the names of the variables in the data set and order for the variables to appear in the hierarchy to produce the hierarchical output. I tried my best to show that in a graphical representation of the hierarchy in the comments at the top of the POC SAS program:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt; Region -+
         |
         +- Subsidiary -+
                        |
                        +- Product -+
                                    |
                                    +- &amp;lt;product data&amp;gt;&lt;/PRE&gt;
&lt;P&gt;The "hard coded WRITE VALUE statements" you mention are generated dynamically by the POC SAS program from the data in the data set. The POC SAS program is what you will need to modify for your specific data set. When modified correctly, the POC SAS program will generate from the data set all the JSON procedure code needed to produce the desired JSON output.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 21:37:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-create-a-hierarchical-JSON-file-using-PROC-JSON/m-p/842990#M333320</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-11-07T21:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to create a hierarchical JSON file using PROC JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-create-a-hierarchical-JSON-file-using-PROC-JSON/m-p/842897#M333287</link>
      <description>&lt;P&gt;I previously posted a &lt;A href="https://communities.sas.com/t5/SAS-Programming/PROC-JSON-create-a-hierarchical-file/m-p/413679#M101279" target="_self"&gt;proof-of-concept SAS program&lt;/A&gt; that produces hierarchical output using PROC JSON. You should be able to use this as a starting point to produce what you want as output.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 16:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-create-a-hierarchical-JSON-file-using-PROC-JSON/m-p/842897#M333287</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-11-07T16:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Export with "type" and "value" requirements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-quot-type-quot-and-quot-value-quot-requirements/m-p/828358#M327220</link>
      <description>&lt;P&gt;I used the data set that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; created so that your original data is in the desired type/value format. Once in this state, the program I posted started by isolating in a data set the data for the client matching "111111". This data set was then used in the JSON procedure EXPORT statement to include the client "111111" data in the JSON output you specified. The program output pretty much matches the left side JSON output you posted (except for the empty "subData" array at the bottom - which is easy to add). These programs demonstrate how to take the original data to produce what I understand to be what you desire.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROGRAM OUTPUT:&lt;/P&gt;
&lt;PRE&gt;{
  "method": "startautomation",
  "methodParameters": [
    {
      "type": "IS_API_CALL",
      "value": "1"
    }
  ],
  "automationKey": "oh_rise",
  "version": "2.0",
  "detail": [
    {
      "id": null,
      "foreignKeyID": null,
      "action": "ADD",
      "keyValue": null,
      "data": [
        {
          "type": "Agency",
          "value": "28"
        },
        {
          "type": "Client",
          "value": "111111"
        },
        {
          "type": "Type",
          "value": "ohr_initial"
        },
        {
          "type": "Start Date",
          "value": "7/29/2022  9:00 AM"
        },
        {
          "type": "End Date",
          "value": "7/29/2022  9:00 AM"
        },
        {
          "type": "Duration (hh:mm)",
          "value": "0"
        },
        {
          "type": "Diagnosis Treated",
          "value": "XXX"
        },
        {
          "type": "NPI",
          "value": "1234567890"
        },
        {
          "type": "Completed By",
          "value": "88888"
        },
        {
          "type": "Place of Service Code",
          "value": "11"
        },
        {
          "type": "Is Telehealth",
          "value": "1"
        },
        {
          "type": "Service Track",
          "value": ""
        },
        {
          "type": "ProgramProvidingService",
          "value": "ohrs"
        },
        {
          "type": "Program Enrollment",
          "value": ""
        },
        {
          "type": "Facility Providing Service",
          "value": "25"
        },
        {
          "type": "Is Initial Contact?",
          "value": "0"
        },
        {
          "type": "Is Crisis",
          "value": "0"
        },
        {
          "type": "Discharge Planning",
          "value": "0"
        },
        {
          "type": "Activity Type",
          "value": "Phone Call"
        },
        {
          "type": "Portal ID",
          "value": "de839c8c-1b61-4c68-907f-652c3c99b00a"
        }
      ]
    }
  ]
}
&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Aug 2022 19:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-quot-type-quot-and-quot-value-quot-requirements/m-p/828358#M327220</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-08-11T19:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Export with "type" and "value" requirements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-quot-type-quot-and-quot-value-quot-requirements/m-p/828292#M327179</link>
      <description>&lt;P&gt;Using the code supplied by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; to create a data set with the data in type/value format, I’ve created a JSON procedure program to produce the example results you specified.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data c111111;
set for_json;
where client=111111;
run;

proc json out=".\client.json" pretty nosastags;
  write open object;
    write values method startautomation;
	write value methodParameters;
	write open array;
	  write open object;
	    write values type IS_API_CALL;
		write values value "1";
        write close; /* methodParameters object */
      write close; /* methodParameters array */
	  write values automationKey oh_rise;
      write values version "2.0";
      write value detail;
	  write open array;
	    write open object;
		  write values id null;
          write values foreignKeyID null;
          write values action ADD;
          write values keyValue null;
          write values data;
		  write open array;
            export c111111(drop=client _name_);
		    write close; /* data array */
	      write close; /* detail object */
	  write close; /* detail array */
    write close; /* outermost object */
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course, this program only produces the JSON output for the client #111111 as shown in your example. To make the JSON procedure program more dynamic, you will need to modify it to use data sets specific to the client number. I have previously written a &lt;A href="https://communities.sas.com/t5/SAS-Programming/PROC-JSON-create-a-hierarchical-file/m-p/413679#M101279" target="_self"&gt;proof-of-concept program&lt;/A&gt; showing how to use the JSON procedure to produce hierarchical JSON output from data sets. You can use the above program as a template for the dynamic version of the program producing output for all the clients.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 15:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-quot-type-quot-and-quot-value-quot-requirements/m-p/828292#M327179</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-08-11T15:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to export Nested JSON with proc JSON?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-export-Nested-JSON-with-proc-JSON/m-p/820556#M81897</link>
      <description>&lt;P&gt;I previously posted a &lt;A href="https://communities.sas.com/t5/SAS-Programming/PROC-JSON-create-a-hierarchical-file/m-p/413679#M101279" target="_self"&gt;proof-of-concept SAS program&lt;/A&gt; that produces hierarchical output using PROC JSON. You should be able to use this as a starting point to produce what you want as output.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 17:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-export-Nested-JSON-with-proc-JSON/m-p/820556#M81897</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-06-27T17:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting multiple values having same path in json using json map in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-multiple-values-having-same-path-in-json-using-json/m-p/806497#M317762</link>
      <description>&lt;P&gt;I just cut out the duplication in the map file that you supplied. &lt;BR /&gt;&lt;BR /&gt;Map file named ./sasuser/json.map&lt;/P&gt;
&lt;PRE&gt;{
  "DATASETS": [
    {
      "DSNAME": "customers",
      "TABLEPATH": "/root/content",
      "VARIABLES": [
        {
          "NAME": "name",
          "TYPE": "CHARACTER",
          "PATH": "/root/content/name"
        },
        {
          "NAME": "value",
          "TYPE": "CHARACTER",
          "PATH": "/root/content/value"
        }        
      ]
    }
  ]
}
&lt;/PRE&gt;
&lt;P&gt;Existing JSON file (named ./sasuser/json.sas):&lt;/P&gt;
&lt;PRE&gt;{
  "totalCount": 2,
  "facets": {},
  "content": [
    [
      {
        "name": "customer_ID",
        "value": "1"
      },
      {
        "name": "customer_name",
        "value": "John"
      }
    ]
  ]
}&lt;/PRE&gt;
&lt;P&gt;SAS code run:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mapRef './sasuser/json.map';
libname x json './sasuser/json.sas' map=mapRef;
proc print data=x.customers; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;OUTPUT:&lt;/P&gt;
&lt;PRE&gt;Obs  name           value 
1    customer_ID    1 
2    customer_name  John &lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 13:01:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-multiple-values-having-same-path-in-json-using-json/m-p/806497#M317762</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-04-07T13:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc HTTP Method="Put" Running Correctly But Not Updating Product</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Method-quot-Put-quot-Running-Correctly-But-Not/m-p/792012#M81477</link>
      <description>&lt;P&gt;As you have found, there does not appear to be a way to get the export statement to give you the JSON format you want. While not ideal, one possibility is to write a program to strip off the outer array characters after the JSON file is created.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Another possibility might be to write a program to dynamically create the PROC JSON code that utilizes WRITE statements to produce the desired output. A proof-of-concept of this technique is in &lt;A href="https://communities.sas.com/t5/SAS-Programming/PROC-JSON-create-a-hierarchical-file/m-p/413679#M101279" target="_self"&gt;this post.&amp;nbsp;&lt;/A&gt;I do not know enough about your requirements to be able to say if the dynamically generated PROC JSON code will work in your case.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 22:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-HTTP-Method-quot-Put-quot-Running-Correctly-But-Not/m-p/792012#M81477</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2022-01-24T22:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing a JSON File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parsing-a-JSON-File/m-p/768180#M243629</link>
      <description>&lt;P&gt;I am not exactly clear one what you want as output from the data. The example you supply only shows part of the data in the output. I suspect you want more output from the data. I am able to replicate what you say you want based on the supplied example output. I hope that code I am supplying will allow you to get an idea of how to solve your problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I put your JSON file into the file named "sasComm768136.json". From there, I ran this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname x json './sasComm768136.json';

data temp(drop=ordinal_root ordinal_cpat_q2 borrower age province);
set x.cpat_q2 end=lastOne;
retain borrower1 age1 province1;
if (_N_ eq 1)
   then do;
       borrower1 = borrower;
	   age1 = age;
	   province1 = province;
     end;
   else do;
       borrower2 = borrower;
	   age2 = age;
	   province2 = province;
     end;
  if lastOne
     then do;
       output;
	   end;
run;

proc print data=work.temp; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This produced:&lt;/P&gt;
&lt;PRE&gt; Obs       borrower1       age1    province1     borrower2     age2    province2
   1     primaryBorrower     57        ON        coBorrower1     53        ON&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Sep 2021 19:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parsing-a-JSON-File/m-p/768180#M243629</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-09-16T19:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to wirte ALLDATA data set back to JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-wirte-ALLDATA-data-set-back-to-JSON/m-p/754990#M238199</link>
      <description>&lt;P&gt;You can programmatically create the desired output in JSON format using PROC JSON. It will be more involved than what you initially tried. I wrote a &lt;A href="https://communities.sas.com/t5/SAS-Programming/PROC-JSON-create-a-hierarchical-file/m-p/413679#M101279" target="_self"&gt;proof-of-concept program&lt;/A&gt; that shows how to create hierarchical JSON formatted output from a SAS data set. You should be able to use the concepts displayed in the program to produce the output you desire. One advantage of the JSON procedure is that it automatically produces syntactically correct JSON from the supplied data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-wirte-ALLDATA-data-set-back-to-JSON/m-p/754990#M238199</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-07-19T14:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Export with the containers in order of the records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-the-containers-in-order-of-the-records/m-p/752161#M236893</link>
      <description>&lt;P&gt;I took some pieces from my proof-of-concept code, your original data set, a recreation of your other data set, and produced this SAS program. It puts each record into a JSON container in a format that is probably close to what you want. I am still not completely clear on your desired JSON output. But you should be able to modify my code to get exactly what you want. Note that my code could be more concise. I wanted to make it understandable to someone not familiar with the techniques used. If you are uncertain, the proof-of-concept code I borrowed from contains many comments explaining the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data json_test;
   infile datalines dlm=',' dsd;
   input Contract $	PartyID	Language $	Role $	Data $	FirstName $	MiddleInitial $	LastName $	EmailAddress $	Override $	Channel $	Product $	Plan $	Type $	UNQID GRPNB $ DIVISIONNB $;
   datalines;
   ABC123,567890,EN,MEMBER,GEN,JOHN,,DOE,,N,EMAIL,P,Sample,A,123456,XXX12,ABC
   DEF456,123456,EN,MEMBER,GEN,JANE,,DOE,,N,EMAIL,H,Sample2,B,789012,YYY34,DEF
;
run;
proc print data=work.json_test; run;

data commReq;
infile datalines dlm=',' dsd;
input source $ sourceTrnsReferenceId $ requesterId $ templateId $ tenateId sourceCompanyCode UNQID;
datalines;
ppx, bfe9961i, svc-ppx, PPX6, 1, 1, 123456
ppx, zgtewwyr, svc-ppx, PPX6, 1, 1, 789012
;
run;
proc print data=work.commReq; run;

data member (keep= Contract	PartyID	Language Role Data)
     delivery (keep= FirstName MiddleInitial LastName EmailAddress	Override Channel)
     additional (keep= Product Plan Type UNQID GRPNB DIVISIONNB);
set work.json_test;
run;
proc print data=work.member; run;
proc print data=work.delivery; run;
proc print data=work.additional; run;

%macro createCommReqDataSet(count, value);
  proc sql;
    create table dsCR_&amp;amp;count as
       select source, sourceTrnsReferenceId, requesterId,
              templateId, tenateId, sourceCompanyCode 
         from work.commReq
         where UNQID=&amp;amp;value
    ;
    quit;
%mend createCommReqDataSet;

%macro createSIDDataSet(count, value);
  proc sql;
    create table dsSID_&amp;amp;count as
       select Contract,PartyID,Language,Role,Data
         from work.json_test
         where UNQID=&amp;amp;value
    ;
    quit;
%mend createSIDDataSet;

%macro createDIDataSet(count, value);
  proc sql;
    create table dsDI_&amp;amp;count as
       select FirstName, MiddleInitial, LastName, EmailAddress, Override, Channel
         from work.json_test
         where UNQID=&amp;amp;value
    ;
    quit;
%mend createDIDataSet;

%macro createEDataSet(count, value);
  proc sql;
    create table dsE_&amp;amp;count as
       select Product, Plan, Type, UNQID, GRPNB, DIVISIONNB
         from work.json_test
         where UNQID=&amp;amp;value
    ;
    quit;
%mend createEDataSet;

data _null_;
  set work.json_test;
  by UNQID;
  call execute('%createCommReqDataSet(' || _N_         || ',' || 
                                           TRIM(UNQID) || ')');
  call execute('%createSIDDataSet('     || _N_         || ',' || 
                                           TRIM(UNQID) || ')');
  call execute('%createDIDataSet('      || _N_         || ',' || 
                                           TRIM(UNQID) || ')');
  call execute('%createEDataSet('       || _N_         || ',' || 
                                           TRIM(UNQID) || ')');
   run;
proc datasets lib=work; quit;

%let stmtEnd=%STR(;);
%macro fileHeader(filePath);
   put "proc json pretty out=""" &amp;amp;filePath """ nosastags &amp;amp;stmtEnd";
   put "write open array &amp;amp;stmtEnd     /* open outermost array */";
%mend fileHeader;

%macro fileFooter();
   put "write close &amp;amp;stmtEnd           /* close outermost object */";
   put "run &amp;amp;stmtEnd";
%mend fileFooter;

%let jsonProcCodeSpec=./sasuser/jsonProcCode.sas;
%let jsonOutputSpec=./sasuser/jsonOutput.txt;

data _null_;
  /* Process each observation in the WORK.json_test data set. The 
     END option set a flag when the last observation in the data set
     is read. The BY statement groups the data by the desired 
     ID.                                                        */
  set work.json_test end=lastOne;
  by UNQID;

  /* specifies the output file for PUT statements                      */
  FILE "&amp;amp;jsonProcCodeSpec" DISK; 

  /* Only on the first observation in the data set, write the required 
     initial statements to the JSON procedure code file.               */
  if _N_ eq 1 
    then do;
      %fileHeader("&amp;amp;jsonOutputSpec");
	  end;

  put "write open object &amp;amp;stmtEnd";
    put "write values commRequest &amp;amp;stmtEnd";
    dsName=CAT("dsCR_",_N_);
    put "export " dsName "&amp;amp;stmtEnd";
    put "write values Source_ID &amp;amp;stmtEnd";
    dsName=CAT("dsSID_",_N_);
    put "export " dsName "&amp;amp;stmtEnd";
    put "write values delivery_info &amp;amp;stmtEnd";
    dsName=CAT("dsDI_",_N_);
    put "export " dsName "&amp;amp;stmtEnd";
    put "write values email &amp;amp;stmtEnd";
    dsName=CAT("dsE_",_N_);
    put "export " dsName "&amp;amp;stmtEnd";
  put "write close &amp;amp;stmtEnd";

    /* Only on the last observation in the data set, write to the JSON
	 procedure code file the required statements to end the generated 
	 JSON procedure.                                                        */
  if lastOne 
     then do;
       %fileFooter();
       end; 
run;

/* Now run the generated custom JSON procedure code to produce the 
   JSON formatted output file of the data set.                         */
%include "&amp;amp;jsonProcCodeSpec";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the output produced:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[
  {
    "commRequest": {
      "source": "ppx",
      "sourceTrnsReferenceId": "bfe9961i",
      "requesterId": "svc-ppx",
      "templateId": "PPX6",
      "tenateId": 1,
      "sourceCompanyCode": 1
    },
    "Source_ID": {
      "Contract": "ABC123",
      "PartyID": 567890,
      "Language": "EN",
      "Role": "MEMBER",
      "Data": "GEN"
    },
    "delivery_info": {
      "FirstName": "JOHN",
      "MiddleInitial": "",
      "LastName": "DOE",
      "EmailAddress": "",
      "Override": "N",
      "Channel": "EMAIL"
    },
    "email": {
      "Product": "P",
      "Plan": "Sample",
      "Type": "A",
      "UNQID": 123456,
      "GRPNB": "XXX12",
      "DIVISIONNB": "ABC"
    }
  },
  {
    "commRequest": {
      "source": "ppx",
      "sourceTrnsReferenceId": "zgtewwyr",
      "requesterId": "svc-ppx",
      "templateId": "PPX6",
      "tenateId": 1,
      "sourceCompanyCode": 1
    },
    "Source_ID": {
      "Contract": "DEF456",
      "PartyID": 123456,
      "Language": "EN",
      "Role": "MEMBER",
      "Data": "GEN"
    },
    "delivery_info": {
      "FirstName": "JANE",
      "MiddleInitial": "",
      "LastName": "DOE",
      "EmailAddress": "",
      "Override": "N",
      "Channel": "EMAIL"
    },
    "email": {
      "Product": "H",
      "Plan": "Sample2",
      "Type": "B",
      "UNQID": 789012,
      "GRPNB": "YYY34",
      "DIVISIONNB": "DEF"
    }
  }
]
&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jul 2021 20:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-the-containers-in-order-of-the-records/m-p/752161#M236893</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-07-05T20:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Export with the containers in order of the records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-the-containers-in-order-of-the-records/m-p/751803#M236717</link>
      <description>&lt;P&gt;Take a look at the code I wrote for a &lt;A href="https://communities.sas.com/t5/SAS-Programming/PROC-JSON-create-a-hierarchical-file/m-p/413679#M101279" target="_self"&gt;proof-of-concept&lt;/A&gt; for creating hierarchical JSON from SAS data sets. This code should give you a way to avoiding having the unique ID in each of the low-level JSON containers.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 18:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-the-containers-in-order-of-the-records/m-p/751803#M236717</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-07-02T18:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Export with the containers in order of the records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-the-containers-in-order-of-the-records/m-p/751717#M236680</link>
      <description>&lt;P&gt;Additional information is needed. The PROC JSON code supplied does not work with the DATA step supplied as the referenced data sets (source1, delivery1, &amp;amp; email) are not defined. Please supply the JSON output you desire from the json_test data set.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 12:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Export-with-the-containers-in-order-of-the-records/m-p/751717#M236680</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-07-02T12:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a function in PROC FCMP using information from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-function-in-PROC-FCMP-using-information-from-a/m-p/742012#M80563</link>
      <description>&lt;P&gt;To answer the original question of how to do this in PROC FCMP, I borrowed the data sets from ballardw and the hash code from andreas_lds. The hash code in this SAS program is a little different because in FCMP that hash object has some differences from the DATA step hash object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data input_1;
   input Var1 $	Var2	Date1 :mmddyy10.	Date2  :mmddyy10.	Date3  :mmddyy10. ;
   format date1 date2 date3 mmddyy10.;
   select (var1);
      when('A') targetdate=date1;
      when('B') targetdate=date2;
      when('C') targetdate=date3;
   end;
datalines;
A	1	1/1/2019	1/16/2020	1/30/2021
B	2	6/15/2018	6/30/2019	7/14/2020
C	2	5/26/2018	6/10/2019	6/24/2020
;
run;

data input_2;
  input Var2	Year	Var3;
datalines;
1	2018	1000
1	2019	2000
1	2020	3000
1	2021	4000
2	2018	5000
2	2019	6000
2	2020	7000
2	2021	8000
;
run;

OPTION CMPLIB=sasuser.funcs;

proc fcmp OUTLIB=sasuser.funcs.example;
   function getVar3(var2, targetDate);
      declare hash h(dataset: 'work.input_2');
	  rc = h.defineKey('var2', 'year');
      rc = h.defineData('var3');
	  rc = h.defineDone();

      year = YEAR(targetDate);
	  rc = h.find();

      return(var3);
	  endsub;
	quit;

data result(drop=targetdate);
  set input_1;
  var3=getVar3(var2, targetdate);
  run;

proc print data=work.result; run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 May 2021 21:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-function-in-PROC-FCMP-using-information-from-a/m-p/742012#M80563</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-05-17T21:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: PROC json with no array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-json-with-no-array/m-p/738902#M230551</link>
      <description>&lt;P&gt;I solved a similar problem in &lt;A href="https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717112#M1122" target="_self"&gt;this post&lt;/A&gt;. As noted there, the EXPORT statement places the data into a JSON container. Since you do not want that behavior, I recommend using a DATA Step to create the needed PROC JSON statements and then running that code.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 13:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-json-with-no-array/m-p/738902#M230551</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-05-04T13:42:08Z</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: Exporting Nested Tables to JSON</title>
      <link>https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717158#M1124</link>
      <description>&lt;P&gt;I produced what was asked. I hope that the technique I showed gives the customer a starting point from which to modify this most-likely simple case to whatever data the customer has.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 17:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717158#M1124</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-02-05T17:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Nested Tables to JSON</title>
      <link>https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717112#M1122</link>
      <description>&lt;P&gt;The PROC JSON EXPORT statement puts each observation of the data set data into a JSON container. Whether the containers are JSON objects or JSON arrays depends on the JSON KEYS argument. Specifying the KEYS argument outputs each observation in a JSON object and NOKEYS outputs to JSON arrays. Your desired JSON shows sending the observations to an already open JSON object. As you have seen, you will not be able to do that with an EXPORT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use PROC JSON and get the desired output, I would recommend using a DATA Step to create the PROC JSON code and then run the generated program. The advantage of using generated PROC JSON code is that that PROC JSON handles producing correct JSON syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the SAS program that will produce the desired output based on your supplied JSON file having been read in via the JSON LIBNAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*****************************
* Modifiable macro variables
******************************/
%let jsonProcCodeSpec=sasuser\jsonProcCode.sas;
%let jsonOutputSpec=sasuser\jsonOutput.txt;

%put &amp;amp;jsonProcCodeSpec;
/*****************************
* Constant macro variables
******************************/
%let stmtEnd=%STR(;);

/* Write the custom PROC JSON code based on the values in the data set. 
   This will be run after the DATA Step creates it. */
data _null_;
  /* specifies the output file for PUT statements                      */
  FILE "&amp;amp;jsonProcCodeSpec" DISK;
  set x.owner(rename=(name=owner_name)) end=last; 

  if _N_ eq 1 
    then do;
      /* Only on the first observation in the data set, write the required 
         initial statements to the JSON procedure code file.                */
      put "proc json pretty out=""&amp;amp;jsonOutputSpec"" nosastags &amp;amp;stmtEnd";
      put "    write open object &amp;amp;stmtEnd";
	  put "      write values ""Owner"" &amp;amp;stmtEnd";
	  put "        write open array &amp;amp;stmtEnd";
	  put "            write open object &amp;amp;stmtEnd";
	  put "              write values ""Cars"" &amp;amp;stmtEnd";
	  put "                write open array &amp;amp;stmtEnd";
	  put "                    export x.owner_cars(drop=ordinal_:) &amp;amp;stmtEnd";
	  put "                write close &amp;amp;stmtEnd";
	  end;
  /* Write the data set Name column to JSON */
  put "write value ""Name"" """owner_Name""" &amp;amp;stmtEnd";
  /* Write the data set Age column to JSON */
  put "write value ""Age"" " age "&amp;amp;stmtEnd";
  if last
    then do;
      /* Only on the last observation in the data set, write the required 
         final statements to the JSON procedure code file.                */
	  put "            write close &amp;amp;stmtEnd";
	  put "        write close &amp;amp;stmtEnd";
	  put "    write close &amp;amp;stmtEnd";
      put "run &amp;amp;stmtEnd";
    end;
run;

/* Now run the generated custom JSON procedure code to produce the 
   JSON formatted output file of the data set.                         */
%include "&amp;amp;jsonProcCodeSpec";
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2021 16:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Exporting-Nested-Tables-to-JSON/m-p/717112#M1122</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-02-05T16:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc json export boolean</title>
      <link>https://communities.sas.com/t5/Developers/proc-json-export-boolean/m-p/716078#M1104</link>
      <description>&lt;P&gt;I initially thought it was easier as well. You can suggest it as a new feature via the &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas" target="_self"&gt;SASware ballot&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 14:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/proc-json-export-boolean/m-p/716078#M1104</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-02-02T14:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: proc json export boolean</title>
      <link>https://communities.sas.com/t5/Developers/proc-json-export-boolean/m-p/715914#M1102</link>
      <description>&lt;P&gt;The SAS data set only supports character and numeric data. The problem you are encountering with the PROC JSON EXPORT statement is that the procedure cannot export Boolean data because there no Boolean data in the data set. You have data that can be interpreted as Boolean data, but the JSON procedure only understands SAS numeric and character data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you need to do is write SAS code to interpret the data for PROC JSON. Instead of the PROC JSON EXPORT statement, you will need to write the data with the PROC JSON WRITE statements. Here is some code to show you what needs to be done. I am using a data set with 2 observations of 3 variables, a numeric, character, and a numeric that can be interpreted as a Boolean. The code I am including uses a DATA step to create the needed PROC JSON statements in a SAS program that will then be run after the DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sourceDataSet=work.test;

data &amp;amp;sourceDataSet;
charData = "Testing some Boolean output";
numData=17;
booleanData=0;
output;
charData = "Testing more Boolean output";
numData=24;
booleanData=1;
output;
run;

proc print data=work.test; run;

/*****************************
* Modifiable macro variables
******************************/
%let jsonProcCodeSpec=./sasuser/jsonProcCode.sas;
%let jsonOutputSpec=./sasuser/jsonOutput.txt;


/*****************************
* Constant macro variables
******************************/
%let stmtEnd=%STR(;);


/* Write the custom PROC JSON code based on the values in the data set. 
   This will be run after the DATA Step creates it. */
data _null_;
  /* specifies the output file for PUT statements                      */
  FILE "&amp;amp;jsonProcCodeSpec" DISK;
  set work.test end=last; 

  if _N_ eq 1 
    then do;
      /* Only on the first observation in the data set, write the required 
         initial statements to the JSON procedure code file.                */
      put "proc json pretty out=""&amp;amp;jsonOutputSpec"" nosastags &amp;amp;stmtEnd";
      put "write open array &amp;amp;stmtEnd /* open outermost object */";
	  end;
  /* Open the JSON object for the current data set observation */
  put "write open object&amp;amp;stmtEnd     /* open  data observation object */";
  /* Write data set character value to JSON */
  put "write value ""charData"" """charData""" &amp;amp;stmtEnd";
  /* Write data set numeric value to JSON */
  put "write value ""numdata"" " numdata "&amp;amp;stmtEnd";
  /* Write JSON Boolean based on the data set "Boolean" value (in this case, 0 or 1). */
  if (booleanData EQ 0)
    then put "write value ""booleanData"" false &amp;amp;stmtEnd ";
    else put "write value ""booleanData"" true  &amp;amp;stmtEnd ";
  /* Close the JSON object for the current data set observation */
  put "write close &amp;amp;stmtEnd          /* close data observation object */";
  if last
    then do;
      /* Only on the last observation in the data set, write the required 
         final statements to the JSON procedure code file.                */
      put "write close &amp;amp;stmtEnd      /* close outermost object */";
      put "run &amp;amp;stmtEnd";
    end;
run;

/* Now run the generated custom JSON procedure code to produce the 
   JSON formatted output file of the data set.                         */
%include "&amp;amp;jsonProcCodeSpec";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the generated PROC JSON code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc json pretty out="./sasuser/jsonOutput.txt" nosastags ;
write open array ; /* open outermost object */
write open object;     /* open  data observation object */
write value "charData" "Testing some Boolean output " ;
write value "numdata" 17 ;
write value "booleanData" false ; 
write close ;          /* close data observation object */
write open object;     /* open  data observation object */
write value "charData" "Testing more Boolean output " ;
write value "numdata" 24 ;
write value "booleanData" true  ; 
write close ;          /* close data observation object */
write close ;      /* close outermost object */
run ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the resultant JSON file:&lt;/P&gt;
&lt;PRE&gt;[
  {
    "charData": "Testing some Boolean output",
    "numdata": 17,
    "booleanData": false
  },
  {
    "charData": "Testing more Boolean output",
    "numdata": 24,
    "booleanData": true
  }
]
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should give you enough information to modify this program to your needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 23:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/proc-json-export-boolean/m-p/715914#M1102</guid>
      <dc:creator>BillM_SAS</dc:creator>
      <dc:date>2021-02-01T23:44:55Z</dc:date>
    </item>
  </channel>
</rss>

