BookmarkSubscribeRSS Feed
PatrickChan
Calcite | Level 5

Anyone can help for my captioned question?  Thanks.

4 REPLIES 4
Ksharp
Super User
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 .


RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

AhmedAl_Attar
Rhodochrosite | Level 12

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 4862 views
  • 0 likes
  • 5 in conversation