My Apologies, it didn't work. It has only fieldname and fieldvalue.
Try it again, the last part of the code got deleted for some reason. I added it back in.
@Pandu2 wrote:
Actually when a new batchNo comes that's the sign of previous BatchNo group ends. That's how I figured out after doing some analysis how the group ends, otherwise our business and I doesn't know how it ends cuz the complexity of data and not following any specific pattern.
That's why the parenthesis are important. They delimit the batches and lines.
Here's the original format of my json data:
{ """BatchNo"":""001"""" "Keys": [ { """Goodsname"":""Nikeshoes"""" """Quantity"":""3"""" """Infotype"":""Sneakers"""" } { """Goodsname"":""pants"""" """Quantity"":""5"""" """Infotype"":""Trackpants"""" """Newly"":"""""" """Infotype"":""RAQ"""" """TypeId"":""109"""" """Cause"":""Broken"""" """Quantity"":""0"""" } }{ """BatchNo"":""009"""" "Keys":[ { """Goodsname"":""Nikeshoes"""" """Quantity"":""3"""" """Infotype"":""Sneakers"""" }{ """Goodsname"":""pants"""" """Quantity"":""5"""" """Infotype"":""Trackpants"""" } ] } { """BatchNo"":""011"""" "Keys":[ { """Goodsname"":""Jackets"""" """Quantity"":""3"""" """Infotype"":""topwears"""" } """Newly"":"""""" """Infotype"":""RAQ"""" """TypeId"":""100"""" """Cause"":""Broken"""" """Quantity"":""0"""" ] }
Thanks @Pandu2 for posting the original json. It is not a well formed json and there is no uniformity between the different records.
For example, for BatchNo 001 there is no closing square bracket '.]' .
So whatever approach you are going to use, data cleaning preparation would consume time. If it is possible, make sure that data comes in a proper format.
@Pandu2 wrote:
Please I request you to help me on this.
Please post the complete log. It is impossible to debug something without knowing what happened actually.
Log:
NOTE: There were 3417992 observations read from the data set work.have.
NOTE: The data set work.want has 1 observations and 10 variables.
NOTE: Compressing data set work.want increased size by 100.00 percent.
Compressing is 2 pages; un- compressed would require 1 pages.
NOTE: DATA statement used(Total process time).
Only these set of lines I've it on my sas log.
Well, i wouldn't invest more time in my solution, but try to import the json file directly with libname statement. Have look at https://support.sas.com/resources/papers/proceedings17/0856-2017.pdf
The log has nothing of value, which means that something in the file is not as expected. Adding some put-statements could help, but i would postpone this, and give the more recent tools to handle json a chance.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.