How do I export a missing string variable to a json file as null rather than ""? SAS Code: data mydata;
INFILE DATALINES DLM='|';
Length CODE 3 Name $ 50;
Input CODE Name;
datalines;
11|Bob
12|Joe
13|Larry
;
run;
data newdata;
length status $2.;
format status $2.;
informat status $2.;
set mydata;
if name = "Joe" then
do;
status=.;
code=.;
end;
else status='Y';
run;
proc json out="P:\newdata.json" pretty NOSASTAGS;
export newdata;
run; Here's what the exported json looks like: [
{
"status": "Y",
"CODE": 11,
"Name": "Bob"
},
{
"status": "",
"CODE": null,
"Name": "Joe"
},
{
"status": "Y",
"CODE": 13,
"Name": "Larry"
}
] Here's what I want (i.e. status for Joe should be null rather than "": [
{
"status": "Y",
"CODE": 11,
"Name": "Bob"
},
{
"status": null,
"CODE": null,
"Name": "Joe"
},
{
"status": "Y",
"CODE": 13,
"Name": "Larry"
}
]
... View more