I think that the program I wrote showing how to create hierarchical JSON will be helpful to you. In it, I solved the problem you had with the 'npi' variable repeating in a child hierarchy. I created with PROC SQL each set of child data in a separate data set (see the createLowLevelDataSet macro). Once all the needed data sets were created, a DATA step iterated through the data creating the various PROC JSON statements needed to create the desired JSON output. I think you can use this technique in your code to get what you want. As for the "year" array, adding this array to the "plans" is just another level of hierarchy. The hierarchy I coded to was: Region -+ | +- Subsidiary -+ | +- Product -+ | +- <product data> It appears that your hierarchy is a little different:
Header-+
|
+- Addresses
+- Plans -+
|
+- Years
... View more