Hi Chris Sorry for not adding any programs or datasets. I created a small dataset that hopefully illustrates the issue. Let's say I have a dataset defined as follows data testdata;
input class $ var1 var2 var3;
datalines;
class1 3 0 1
class2 2 2 .
class3 1 1 1
; I have a number of class variables, each with a set of (in this case numeric) values. Now, I wish to export the data as a .JSON file that is to be read elsewhere, where it doesn't matter if a given value is empty, 0 or missing. Therefore, I wish to remove these values from the exported .JSON file. Using a normal proc json, proc json out = 'Y:\jsonout.json' pretty nosastags ;
export testdata;
run; I get the following: [ { "class": "class1", "var1": 3, "var2": 0, "var3": 1 }, { "class": "class2", "var1": 2, "var2": 2, "var3": null }, { "class": "class3", "var1": 1, "var2": 1, "var3": 1 } ] So basically, I wish to create a .JSON file that does not include "var2" for "class1" and "var3" for "class2", but every other variable. What I want is the following: [ { "class": "class1", "var1": 3, "var3": 1 }, { "class": "class2", "var1": 2, "var2": 2, }, { "class": "class3", "var1": 1, "var2": 1, "var3": 1 } ] I hope this example helps.
... View more