Hello,
I try to output a JSON-File from three different tables.
What I want is this:
{
"ID":"1",
"Status":"2",
"Rechtsform_ID":"3",
"Mitarbeiter": [
{
"WERT": "0",
"QS": "X.99.9"
},
{
"WERT": "1",
"QS": "X.99.9"
}
],
"EFE": [
{
"FUNKTIONSART": "2",
"PROXY": "0",
"PERSKEYS": "AAA1BB2CCC",
"GEBDAT": "1970-08-12",
"EINTRITT": "2011-08-12"
},
{
"FUNKTIONSART": "2",
"PROXY": "0",
"PERSKEYS": "xxxxxx",
"GEBDAT": "1970-08-12",
"EINTRITT": "2011-08-12"
}
]
}
But I have a problem with the first part (table sub_main). How can I export this, without an array (just key-value)?
This is the program I have:
data sub_main;
ID="1";Status="2";Rechtsform_ID="3";output;
run;
data sub_ma;
WERT="0"; QS="X.99.9"; output;
WERT="11"; QS="X.99.9"; output;
run;
data sub_efe;
FUNKTIONSART="2";
PROXY="0";
PERSKEYS="AAA1BB2CCC";
GEBDAT="1970-08-12";
EINTRITT="2011-08-12";
output;
FUNKTIONSART="2";
PROXY="0";
PERSKEYS="xxxxxx";
GEBDAT="1970-08-12";
EINTRITT="2011-08-12";
output;
run;
proc json out="D:\Output_HAVE.json" pretty nosastags;
write open object;
/* write vaules "ID" "1";*/ /*<<<< works, bust its "hard coded*/
/* export sub_main*/ /*<<<<< dont work ;(*/
write values "Mitarbeiter";
write open array;
export sub_ma;
write close;
write values "EFE";
write open array;
export sub_efe;
write close;
write close;
run;
And thats the result:
{
"Mitarbeiter": [
{
"WERT": "0",
"QS": "X.99.9"
},
{
"WERT": "1",
"QS": "X.99.9"
}
],
"EFE": [
{
"FUNKTIONSART": "2",
"PROXY": "0",
"PERSKEYS": "AAA1BB2CCC",
"GEBDAT": "1970-08-12",
"EINTRITT": "2011-08-12"
},
{
"FUNKTIONSART": "2",
"PROXY": "0",
"PERSKEYS": "xxxxxx",
"GEBDAT": "1970-08-12",
"EINTRITT": "2011-08-12"
}
]
}