BookmarkSubscribeRSS Feed
Areksoo
Calcite | Level 5

Reading our JSON files works perfectly using the following code:

 

filename map temp;

libname blah json "&data_dir./JSONFILE.json" map=map automap=reuse;

 

However, we are trying to automate the process which means running in UNIX.  The above code only takes 10 minutes to run normally, but in UNIX, it takes 2 hours to run.

 

The JSON file is fairly complex where it will create 35 tables and when you look at the ALLDATA table, the variables go up to P8.  

 

Does anyone know what is causing this?  And also any solution to this problem?

5 REPLIES 5
Tom
Super User Tom
Super User

Might just be a difference in the performance of the two machines.  Normally Unix machines are multi-user so it might be that your test ran at a time when the server had other heavy load.  Turn on the FULLSTIMER option and re-run the tests and see if the additional timing details in the log help you understand.

Areksoo
Calcite | Level 5

Unfortunately the issue is directly with the libname statement.  There's no timing stats returned in with a libname statement.

 

I've got a feeling that the cache is the issue as this process runs on the weekends where automated processes are at a minimum.  I have asked the testing team to use the option JSONCOMPRESS.  More CPU time, but less use of memory.  

Tom
Super User Tom
Super User

In that case you might want to open a ticket with SAS Support so you can send them a copy of the JSON file so they can test.

 

If the file(s) uses a fixed definition you could make the LIBNAME statement run faster by not asking it to try to guess what the layout of the data is by examining the file. Instead create the map file yourself (perhaps you can just upload the one you created on Windows) and tell it to use that.

Areksoo
Calcite | Level 5

Unfortunately it's not fixed.  It's mostly fixed, but the development team will add new fields every so often... which is how it balloon to what it is now.   

Tom
Super User Tom
Super User

@Areksoo wrote:

Unfortunately it's not fixed.  It's mostly fixed, but the development team will add new fields every so often... which is how it balloon to what it is now.   


Some programmers seem to think that using the flexibility of JSON (or XML) eliminates the need to plan out what your data fields are. Instead if just pushes the need onto the users of the data.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1315 views
  • 0 likes
  • 2 in conversation