BookmarkSubscribeRSS Feed
Syedilyas_Sas
Fluorite | Level 6

i have a customer data table and would like to create a JSON output file using SAS, in specific hierarchy similar to one below.. Thanks

 

[

  {

     "Entity" : "Sale",

      "TransactionID"  : "20190110_AC879",

     "Fields" : {

                     "type" : "Individual",

                     "cust_name" : "Bob Lee",

                     "item_code" : "BV9849",

                     "amt_prItem" : "99.99",

                   

                      and so on....

 

                    }

 

 {

    "Entity" : "Sale",

      "TransactionID"  : "20190123_ZR067",

     "Fields" : {

                     "type" : "Individual",

                     "cust_name" : "Sarah Doe",

                     "item_code" : "BV8549"

                     "amt_prItem" : "15.09"

 

                     and so on..

                    }

}

]

 

                       

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

What's your SAS table like?

Post the data as a data step or proc sql please.

Syedilyas_Sas
Fluorite | Level 6

example which i shared was just the made up table and the actual data is critical and sensitive to the business.. 

 

Please feel free to pick any table from sashelp for explation purpose.. all i need is to display each observation in a hirarchial manner... much apperiate

Syedilyas_Sas
Fluorite | Level 6

Thanks a lot Chris for your prompt respond.. in the example that i have provided, specially the "TransactionID" is unique for each observation and drives the othes values. Since the data contains numerous records which infact limiting me to  write the code for each transaction id.. So any assistance with the code would be a great help

BillM_SAS
SAS Employee

To a previous question about creating hierarchical JSON output from SAS, I wrote a SAS program that produced hierarchical JSON output from the "shoes" data set in SASHELP. Take a look at that program and see if you can modify it for your purposes.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1151 views
  • 1 like
  • 3 in conversation