I am trying to pass a json to the SAS Viya API by using proc http. My json data needs to contain some macro variables for table uri and template href and uris In python, the data looks like this: data = {
"name": name,
"dataTableUri": dataTableUri,
"type": "predictive",
"pipelineBuildMethod": "template",
"analyticsProjectAttributes": {
"targetVariable" : target,
"partitionEnabled" : True,
"targetEventLevel" : "1"
},
"settings": {
"applyGlobalMetadata" : "false"
},
"links":
[
{
"method": "GET",
"rel": "initialPipelineTemplate",
"href": pipelineHref,
"uri": pipelineUri,
"type": "application/vnd.sas.analytics.pipeline.template"
}
]
} In sas, I am trying the following to create the json data: filename json_in temp;
data _null_;
file json_in;
input text $500.;
textResolved=dequote(resolve(quote(text)));
put _infile_;
datalines;
{"name": name,
"dataTableUri": &dataTableUri.,
"type": "predictive",
"pipelineBuildMethod": "template",
"analyticsProjectAttributes": {
"targetVariable" : &target,
"partitionEnabled" : True,
"targetEventLevel" : "1"
},
"settings": {
"applyGlobalMetadata" : "false"
},
"links":
[
{
"method": "GET",
"rel": "initialPipelineTemplate",
"href": &pipelineHref.,
"uri": &pipelineUri.,
"type": "application/vnd.sas.analytics.pipeline.template"
}
]
} But I just get problems with unbalanced qoutes. Creating the json without using deqoute(resolve(qoute(... ))) to resolve the macro varaibles in this way works, but doesnt solve my problem, since I need to fill in those values filename json_in temp;
data _null_;
file json_in;
input ;
put _infile_;
datalines;
{"name": name,
"dataTableUri": &dataTableUri.,
"type": "predictive",
"pipelineBuildMethod": "template",
"analyticsProjectAttributes": {
"targetVariable" : &target,
"partitionEnabled" : True,
"targetEventLevel" : "1"
},
"settings": {
"applyGlobalMetadata" : "false"
},
"links":
[
{
"method": "GET",
"rel": "initialPipelineTemplate",
"href": &pipelineHref.,
"uri": &pipelineUri.,
"type": "application/vnd.sas.analytics.pipeline.template"
}
]
}
run;
... View more