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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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