Production Ready Macros for SAS Application Developers File Reference

Writes JSON in SASjs format to a fileref. More...

Go to the source code of this file.

Detailed Description

PROC JSON is faster but will produce errs like the ones below if special chars are encountered.

(ERR)OR: Some code points did not transcode.

An object or array close is not valid at this point in the JSON text.

Date value out of range

If this happens, try running with ENGINE=DATASTEP.


  filename tmp temp;
  data class; set sashelp.class;run;


  data _null_;
  infile tmp;

If you are building web apps with SAS then you are strongly encouraged to use the mX_createwebservice macros in combination with the sasjs adapter. For more information see

actionValid values:
  • OPEN - opens the JSON
  • OBJ - sends a table with each row as an object
  • ARR - sends a table with each row in an array
  • CLOSE - closes the JSON
dsthe dataset to send. Must be a work table.
jref=the fileref to which to send the JSON
dslabel=the name to give the table in the exported JSON
fmt=Whether to keep or strip formats from the table
engine=Which engine to use to send the JSON, valid options are:
  • PROCJSON (default)
  • DATASTEP (more reliable when data has non standard characters)
dbg=DEPRECATED - was used to conditionally add PRETTY to proc json but this can cause line truncation in large files.

Related Macros @li @version 9.2 @author Allan Bowe @source

Definition in file