Is there a SAS library that makes it possible to use a web API that only returns data in the JSON format?
asked 01 Dec '10, 19:19
No. I asked the same around a year ago and that was the answer.
Consider having SAS call a .NET or Java library, convert the data, then pump it back to SAS.
If SAS has something now that supports it, I would love to know.
answered 01 Dec '10, 19:33
I don't think there's a need to call out to a middle layer.
Why not just use the
answered 02 Dec '10, 14:49
Pure SAS JSON
All, this is a totally naive implementation of a pure SAS JSON parser . If you feed it a FILENAME ref pointing to a URL that generates JSON (preferrably on one line ... :) and a variable list (right now it has to be IN THE ORDER it shows up in the JSON). Its relatively robust for simple single- and multi-row datasets. Hierarchical data is not supported. You could probably take this and run with it to the hills and beyond if you wanted.
In any case, the OP test JSON is parsed perfectly. In addition, you can call a normal Facebook Graph API url for an ID and get that data into a dataset as well. Output is a SAS dataset named "JSON" (shock).
Examples of calling it
using the originally posted test json string
This results in 3 records with the data specified in the OP sample.
using Facebook Graph API
This results in one record with all of my facebook public info.
As I've said, it's naive, assumes a lot via convention, needs to be expanded and more dynamic, etc. But for now, it handles BASIC json parsing.
answered 21 Dec '11, 18:00
i think this can be solved with a JSON -> PERL -> XML -> SAS workflow?
answered 02 Dec '10, 12:27