Here is some JSON. I omitted "number" in several entries.
[
{
"type": "Full",
"info" : [
{ "name" : "Eric" , "age" : 21, "phone" : [
{ "type" : "cell" },
{ "type" : "home", "number" : "542" }
]
},
{ "name" : "John", "age" : 22, "phone" : [
{ "type" : "cell", "number" : "456" },
{ "type" : "home"},
{ "type" : "home"}
]
}
]
},
{
"type": "Part",
"info" : [
{ "name" : "Bjorn" , "age" : 27, "phone" : [
{ "type" : "cell", "number" : "721" },
{ "type" : "burner"}
]
}
]
}
]Here is a map. I am reading "number" 3 times:
{
"DATASETS": [
{
"DSNAME": "all",
"TABLEPATH": "/root/info/phone",
"VARIABLES": [
{
"NAME": "Type",
"TYPE": "CHARACTER",
"PATH": "/root/info/phone/type"
},
{
"NAME": "number1",
"TYPE": "CHARACTER",
"PATH": "/root/info/phone/number"
},
{
"NAME": "number2",
"TYPE": "NUMERIC",
"PATH": "/root/info/phone/number",
"INFORMAT": ["BEST", 3, 0]
},
{
"NAME": "number3",
"TYPE": "NUMERIC",
"PATH": "/root/info/phone/number"
}
]
}
]
}Here are the results.
filename jsondata "example.json";
filename example "example.map";
libname example JSON fileref=jsondata map=example;
data work.test;
set example.all;
run;
When using an informat, the results seem to be getting retained instead of appearing as missing. How do I fix this?
You might have a contact Tech Support and see if this is a defect.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.