{ "members": [ { "name": "services", "type": "folder", "members": [ { "name": "admin", "type": "folder", "members": [ { "name": "exportconfig", "type": "service", "code": "\n\n%macro mf_getuser(\n)/*/STORE SOURCE*/;\n %local user;\n\n %if %symexist(_sasjs_username) %then %let user=&_sasjs_username;\n %else %if %symexist(SYS_COMPUTE_SESSION_OWNER) %then %do;\n %let user=&SYS_COMPUTE_SESSION_OWNER;\n %end;\n %else %if %symexist(_metaperson) %then %do;\n %if %length(&_metaperson)=0 %then %let user=&sysuserid;\n /* sometimes SAS will add @domain extension - remove for consistency */\n /* but be sure to quote in case of usernames with commas */\n %else %let user=%unquote(%scan(%quote(&_metaperson),1,@));\n %end;\n %else %let user=&sysuserid;\n\n %quote(&user)\n\n%mend mf_getuser;\n/**\n @file mp_jsonout.sas\n @brief Writes JSON in SASjs format to a fileref\n @details This macro can be used to OPEN a JSON stream and send one or more\n tables as arrays of rows, where each row can be an object or a nested array.\n\n There are two engines available - DATASTEP or PROCJSON.\n\n PROC JSON is fast but will produce errs like the ones below if\n special chars are encountered.\n\n > (ERR)OR: Some code points did not transcode.\n\n > An object or array close is not valid at this point in the JSON text.\n\n > Date value out of range\n\n If this happens, try running with ENGINE=DATASTEP.\n\n The DATASTEP engine is used to handle special SAS missing numerics, and\n can also convert entire datasets to formatted values. Output JSON is always\n in UTF-8.\n\n Usage:\n\n filename tmp temp;\n data class; set sashelp.class;run;\n\n %mp_jsonout(OPEN,jref=tmp)\n %mp_jsonout(OBJ,class,jref=tmp)\n %mp_jsonout(OBJ,class,dslabel=class2,jref=tmp,showmeta=Y)\n %mp_jsonout(CLOSE,jref=tmp)\n\n data _null_;\n infile tmp;\n input;putlog _infile_;\n run;\n\n If you are building web apps with SAS then you are strongly encouraged to use\n the mX_createwebservice macros in combination with the\n [sasjs adapter](https://github.com/sasjs/adapter).\n For more information see https://sasjs.io\n\n @param [in] action Valid values:\n @li OPEN - opens the JSON\n @li OBJ - sends a table with each row as an object\n @li ARR - sends a table with each row in an array\n @li CLOSE - closes the JSON\n @param [in] ds The dataset to send. Must be a work table.\n @param [out] jref= (_webout) The fileref to which to send the JSON\n @param [out] dslabel= The name to give the table in the exported JSON\n @param [in] fmt= (Y) Whether to keep (Y) or strip (N) formats from the table\n @param [in] engine= (DATASTEP) Which engine to use to send the JSON. Options:\n @li PROCJSON (default)\n @li DATASTEP (more reliable when data has non standard characters)\n @param [in] missing= (NULL) Special numeric missing values can be sent as NULL\n (eg `null`) or as STRING values (eg `\".a\"` or `\".b\"`)\n @param [in] showmeta= (N) Set to Y to output metadata alongside each table,\n such as the column formats and types. The metadata is contained inside an\n object with the same name as the table but prefixed with a dollar sign - ie,\n `,\"$tablename\":{\"formats\":{\"col1\":\"$CHAR1\"},\"types\":{\"COL1\":\"C\"}}`\n @param [in] maxobs= (MAX) Provide an integer to limit the number of input rows\n that should be converted to JSON\n\n