DATA Step, Macro, Functions and more

How to import a JSON file in SAS?

Reply
Occasional Learner
Posts: 1

How to import a JSON file in SAS?

Anyone can help for my captioned question?  Thanks.

Super User
Posts: 9,691

Re: How to import a JSON file in SAS?

1)PROC DS2  has a JSON package.

2)Data Step code.

I am not familiar with DS2. but if you could post that JSON file,
maybe I could write some data step code to get it .


Super User
Super User
Posts: 7,430

Re: How to import a JSON file in SAS?

Its pretty straight forward for datastep processing, read in the file as a text string,

on { start new id,

parameter=scan(string,1,"=") 

if scan(string,2,"=") contains " then result_character=scan(string,2,"=")

else result_numeric=input(scan(string,2,"="),best.)

 

resulting dataset should then have each parameter and either test or number result which can then be transposed up.

Regular Contributor
Posts: 213

Re: How to import a JSON file in SAS?

Hi,

 

You can have a look at Chris Hemedinger's blog "Using SAS DS2 to parse JSON" and Mark Jordan's (SAS Jedi) blog "Jedi SAS Tricks: DS2 & APIs - GET the data you are looking for" for usage examples.

 

 

Hope this helps,

Ahmed

Valued Guide
Posts: 505

Re: How to import a JSON file in SAS?

Ask a Question
Discussion stats
  • 4 replies
  • 600 views
  • 0 likes
  • 5 in conversation