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..
}
}
]
What's your SAS table like?
Post the data as a data step or proc sql please.
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
Have you read this?
If yes what's the limitation?
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
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.