Tom: Hi, I'm back at this after for the holidays and some other work. With a fresh deep dive in, I realized something significant. Returning to the JSON file I included in the initial post 2 weeks ago. I ran the following code (with ORDINACOUNT=ALL as you suggested): libname in5 json '/my/home/m1xxx00/json/fivefive.json'
map='user5.map' automap=create ordinalcount=all;
libname xxx '/my/home/m1xxx00/json/example6';
proc copy in=in5 out=xxx;
run; The library referenced by XXX had the following data sets (ignoring ALLDATA): income_salary, income_stocks, root, tax_cartax, tax_incometax, tax All 6 data sets had the variable ORDINAL_ROOT and now a simple merge of all these data sets generated the correct data. None of the steps I described previously were needed. data simpledata6;
merge xxx.root xxx.income_salary xxx.income_stocks xxx.tax xxx.tax_incometax xxx.tax_cartax;
by ordinal_root;
drop ordinal_:;
run; Data set SIMPLEDATA6 had all the values we wanted: i
n i
c n
o c
m o
e m
t e
a t
x a
_ x
s s s s e _ c c
a a t t s s w a a
c l l o o a t i r r
o a a c c l i t t t
u r r k k e m h a a
n c y y s s s a h x x
O t i _ _ _ _ t t e _ _
b r t h h h h a e l h h
s y y 1 2 1 2 x d d 1 2
1 usa chicago 35 45 8 12 5 3 7 2 2 I then tried a slightly different data set with blocks of records like the following and the same thing was true - they all had ORDINAL_ROOT, with appropriate values for each block, and the simple merge worked. [
{
"country": "usa",
"city": "chicago",
"income": {
"salary": {
"salary_h1": 35,
"salary_h2": 45
},
"bonus": 10,
"stocks": {
"stocks_h1": 8,
"stocks_h2": 12
}
},
"tax": {
"incometax": {
"incometax_estimated": 3,
"incometax_withheld": 7
},
"salestax": 5,
"cartax": {
"cartax_h1": 2,
"cartax_h2": 2
}
},
...... (additional blocks like these).......
] So, I'm wondering about a few things. 1. Why did the documentation use the indirect method that it did? 2. How generalized is this solution? I'm not sure how much time you have for this but it seems to me that a simplified way to read JSON files would be useful to many people. Thanks, Bruce
... View more