-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathOCR - Document Analysis - Produce Usage Report Output.step
1 lines (1 loc) · 19.3 KB
/
OCR - Document Analysis - Produce Usage Report Output.step
1
{"creationTimeStamp":"2024-12-05T14:47:33.304Z","modifiedTimeStamp":"2024-12-05T14:48:45.766Z","createdBy":"winado","modifiedBy":"winado","name":"OCR - Document Analysis - Produce Usage Report Output.step","displayName":"OCR - Document Analysis - Produce Usage Report Output.step","localDisplayName":"OCR - Document Analysis - Produce Usage Report Output.step","properties":{},"links":[{"method":"GET","rel":"self","href":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","uri":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","type":"application/vnd.sas.data.flow.step"},{"method":"GET","rel":"alternate","href":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","uri":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","type":"application/vnd.sas.data.flow.step.summary"},{"method":"GET","rel":"up","href":"/dataFlows/steps","uri":"/dataFlows/steps","type":"application/vnd.sas.collection","itemType":"application/vnd.sas.data.flow.step.summary"},{"method":"PUT","rel":"update","href":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","uri":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","type":"application/vnd.sas.data.flow.step","responseType":"application/vnd.sas.data.flow.step"},{"method":"DELETE","rel":"delete","href":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","uri":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b"},{"method":"POST","rel":"copy","href":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b/copy","uri":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b/copy","responseType":"application/vnd.sas.data.flow.step"},{"method":"GET","rel":"transferExport","href":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","uri":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","responseType":"application/vnd.sas.transfer.object"},{"method":"PUT","rel":"transferImportUpdate","href":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","uri":"/dataFlows/steps/510fa090-4a87-469f-9586-acc7a6d82f8b","type":"application/vnd.sas.transfer.object","responseType":"application/vnd.sas.summary"}],"metadataVersion":0.0,"version":2,"type":"code","flowMetadata":{"inputPorts":[],"outputPorts":[]},"ui":"{\n\t\"showPageContentOnly\": true,\n\t\"pages\": [\n\t\t{\n\t\t\t\"id\": \"pageOptions\",\n\t\t\t\"type\": \"page\",\n\t\t\t\"label\": \"Options\",\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_sda_explainer_txt\",\n\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\"text\": \"SAS Studio Custom Step for executing the SAS Document Analysis report creation process. At a minimum, users must specify the report type to be output, the file format of the report, and the SAS Launcher Context ID to execute against.\\n\\nFor more details, please reference the link to the official documentation in the about page of this step.\",\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_sda_command\",\n\t\t\t\t\t\"type\": \"dropdown\",\n\t\t\t\t\t\"label\": \"Select report type:\",\n\t\t\t\t\t\"items\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"create_batch_summary_report.py\",\n\t\t\t\t\t\t\t\"label\": \"Batch Summary\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"create_batch_transactions_report.py\",\n\t\t\t\t\t\t\t\"label\": \"Batch Transactions\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"create_file_summary_report.py\",\n\t\t\t\t\t\t\t\"label\": \"File Summary\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"create_file_transactions_report.py\",\n\t\t\t\t\t\t\t\"label\": \"File Transactions\"\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t\"required\": true,\n\t\t\t\t\t\"placeholder\": \"\",\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_sda_report_output_format\",\n\t\t\t\t\t\"type\": \"dropdown\",\n\t\t\t\t\t\"label\": \"Select report output format:\",\n\t\t\t\t\t\"items\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"xlsx\",\n\t\t\t\t\t\t\t\"label\": \"Excel (XLSX)\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"csv\",\n\t\t\t\t\t\t\t\"label\": \"CSV\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"html\",\n\t\t\t\t\t\t\t\"label\": \"HTML\"\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t\"required\": true,\n\t\t\t\t\t\"placeholder\": \"\",\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_sda_launcher_context_id\",\n\t\t\t\t\t\"type\": \"textfield\",\n\t\t\t\t\t\"label\": \"Enter the SAS launcher context ID:\",\n\t\t\t\t\t\"placeholder\": \"ex. b7be2e5f-a65a-4659-8e4e-84d833b2bcc5\",\n\t\t\t\t\t\"required\": true,\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_sda_report_filters_section\",\n\t\t\t\t\t\"type\": \"section\",\n\t\t\t\t\t\"label\": \"Optional settings and report filters\",\n\t\t\t\t\t\"open\": false,\n\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\"children\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"_sda_bypass_ssl_security\",\n\t\t\t\t\t\t\t\"type\": \"checkbox\",\n\t\t\t\t\t\t\t\"label\": \"Bypass SSL security check\",\n\t\t\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"_sda_wait_for_completion\",\n\t\t\t\t\t\t\t\"type\": \"checkbox\",\n\t\t\t\t\t\t\t\"label\": \"Wait for batch execution before terminating (synchronous processing)\",\n\t\t\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"_sda_report_batch_sk_list\",\n\t\t\t\t\t\t\t\"type\": \"textfield\",\n\t\t\t\t\t\t\t\"label\": \"Enter batch SK filter (provide as a comma-separated list):\",\n\t\t\t\t\t\t\t\"placeholder\": \"ex. 1, 2, 3\",\n\t\t\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\t\t\"indent\": 0\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"_sda_report_batch_tag_list\",\n\t\t\t\t\t\t\t\"type\": \"textfield\",\n\t\t\t\t\t\t\t\"label\": \"Enter batch tag filter (provide as comma-separated list):\",\n\t\t\t\t\t\t\t\"placeholder\": \"ex. Batch_123, Batch_ABC\",\n\t\t\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\t\t\"indent\": 0\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"_sda_report_min_dt\",\n\t\t\t\t\t\t\t\"type\": \"datetime\",\n\t\t\t\t\t\t\t\"label\": \"Select the earliest execution date:\",\n\t\t\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\t\t\"indent\": 0\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"_sda_report_max_dt\",\n\t\t\t\t\t\t\t\"type\": \"datetime\",\n\t\t\t\t\t\t\t\"label\": \"Select the latest execution date:\",\n\t\t\t\t\t\t\t\"required\": false,\n\t\t\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\t\t\"indent\": 0\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"_sda_report_include_header\",\n\t\t\t\t\t\t\t\"type\": \"checkbox\",\n\t\t\t\t\t\t\t\"label\": \"Include report header? (Show filter criteria in output)\",\n\t\t\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"id\": \"pageAbout\",\n\t\t\t\"type\": \"page\",\n\t\t\t\"label\": \"About\",\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"textAbout\",\n\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\"text\": \"OCR - Document Analysis - Produce Usage Report Output step\\n==========\\n\\nThe \\\"OCR - Document Analysis - Produce Usage Report Output\\\" custom steps enables an easy integration with the SAS Document Analysis (SDA) model, to create output reports on executed runs.\\n\\nThe location of the generated output will be displayed for after running this step.\\n\\nThis step can be run after you executed a batch OCR process, for example by using the OCR - Document Analysis - Execute Batch OCR Process custom step.\\n\",\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"sectionPrereqs\",\n\t\t\t\t\t\"type\": \"section\",\n\t\t\t\t\t\"label\": \"Pre-requisites\",\n\t\t\t\t\t\"open\": false,\n\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\"indent\": 0,\n\t\t\t\t\t\"children\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"textPrereqs\",\n\t\t\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\t\t\"text\": \"A license for SAS Document Analysis (SDA) is required and you will need to know the ID of the launch context that was created during the deployment of SDA.\\n\\nPre-requisites: Tested on Viya version Stable 2024.08\",\n\t\t\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"sectionDocumentation\",\n\t\t\t\t\t\"type\": \"section\",\n\t\t\t\t\t\"label\": \"Documentation\",\n\t\t\t\t\t\"open\": false,\n\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\"children\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"textDocumentation\",\n\t\t\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\t\t\"text\": \"* SAS Document Analysis documentation (https://go.documentation.sas.com/doc/en/aaimdacdc/default/aaimdawlcm/home.htm)\",\n\t\t\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"sectionChangelog\",\n\t\t\t\t\t\"type\": \"section\",\n\t\t\t\t\t\"label\": \"Changelog\",\n\t\t\t\t\t\"open\": true,\n\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\"children\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"textChangelog\",\n\t\t\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\t\t\"text\": \"* Version 1.1 (29OCT2024)\\n - Implemented feedback\\n\\n* Version: 1.0 (07OCT2024)\\n - Initial version\",\n\t\t\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t],\n\t\"syntaxversion\": \"1.3.0\",\n\t\"values\": {\n\t\t\"_sda_command\": null,\n\t\t\"_sda_report_output_format\": {\n\t\t\t\"value\": \"xlsx\",\n\t\t\t\"label\": \"Excel (XLSX)\"\n\t\t},\n\t\t\"_sda_launcher_context_id\": \"\",\n\t\t\"_sda_bypass_ssl_security\": false,\n\t\t\"_sda_wait_for_completion\": true,\n\t\t\"_sda_report_batch_sk_list\": null,\n\t\t\"_sda_report_batch_tag_list\": \"\",\n\t\t\"_sda_report_min_dt\": null,\n\t\t\"_sda_report_max_dt\": null,\n\t\t\"_sda_report_include_header\": false\n\t}\n}","templates":{"SAS":"* _sda_ is short for SAS Document Analysis;\ndata _null_;\n * Check that the user provided a valid ID for the launcher context;\n if not prxMatch('/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i', \"&_sda_launcher_context_id.\") then do;\n putLog 'ERROR: The provided launcher context ID is not valid.';\n abort 42;\n end;\nrun;\n\n/*Clean up whitespace around delimited list entries*/\n%let _sda_report_batch_tag_list = %sysfunc(compbl(%quote(&_sda_report_batch_tag_list.)));\n%let _sda_report_batch_tag_list = %sysfunc(tranwrd(%quote(&_sda_report_batch_tag_list.), %str(, ), %str(,)));\n%let _sda_report_batch_tag_list = %sysfunc(tranwrd(%quote(&_sda_report_batch_tag_list.), %str( ,), %str(,)));\n\n%let _sda_report_batch_sk_list = %sysfunc(compbl(%quote(&_sda_report_batch_sk_list.)));\n%let _sda_report_batch_sk_list = %sysfunc(tranwrd(%quote(&_sda_report_batch_sk_list.), %str(, ), %str(,)));\n%let _sda_report_batch_sk_list = %sysfunc(tranwrd(%quote(&_sda_report_batch_sk_list.), %str( ,), %str(,)));\n\n* Create a temporary file;\nfilename _sda_out temp; \n\n* Get the Viya Host URL;\n%let _sda_viya_host=%sysfunc(getoption(SERVICESBASEURL));\n\n* Preprocess macrovars to convert binary to boolean;\n%if &_sda_report_include_header. %then %do; %let _sda_report_include_header = True; %end;\n%else %do; %let _sda_report_include_header = False; %end;\n%if &_sda_wait_for_completion. %then %do; %let _sda_wait_for_completion=True; %end;\n%else %do; %let _sda_wait_for_completion = False; %end;\n%if %symexist(_sda_max_wait_time_minutes)=0 %then %do; %let _sda_max_wait_time_minutes = 0; %end;\n\n* Compose http request body message;\n%let _sda_http_request_body=%str({ \"name\":\"sda-produce-usage-report\",\n \"description\":\"Output SAS Document Analysis Usage Report\",\n \"command\":\"python process/sda-ocr/scripts/%superq(_sda_command)\",\n \"contextId\":\"%superq(_sda_launcher_context_id)\",\n \"environment\":{\n \"REPORT_OUTPUT_FORMAT\":\"%superq(_sda_report_output_format)\",\n \"REPORT_INCLUDE_HEADER\":\"%superq(_sda_report_include_header)\",\n \"REPORT_BATCH_SK_LIST\":\"%superq(_sda_report_batch_sk_list)\",\n \"REPORT_BATCH_TAG_LIST\":\"%superq(_sda_report_batch_tag_list)\",\n \"REPORT_MIN_DT\":\"%superq(_sda_report_min_dt)\",\n \"REPORT_MAX_DT\":\"%superq(_sda_report_max_dt)\"\n }, \n \"kubernetes\": {\"jobNamePrefix\": \"sda-execute-report-\"} \n });\n\n* Proc HTTP Request;\nproc http method='Post' \n url=\"&_sda_viya_host./launcher/processes\" \n in=%tslit(&_SDA_HTTP_REQUEST_BODY)\n oauth_bearer=sas_services\n out=_sda_out; \n headers 'Accept'='application/vnd.sas.launcher.process+json'; \n headers 'Content-Type'='application/json';\n %if &_sda_bypass_ssl_security. %then %do;\n SSLPARMS \"SSLREQCERT\" = \"ALLOW\";\n %end;\t\nrun; quit;\n\n%if %symexist(SYS_PROCHTTP_STATUS_CODE) %then %do;\n\t* HTTP Status Handling;\n\tdata _null_; \n\t if &SYS_PROCHTTP_STATUS_CODE. lt 400 then do; \n\t putLog 'NOTE: The request to launch the SDA process was successful.'; \n\t putLog \"NOTE: The HTTP Status Code is &SYS_PROCHTTP_STATUS_CODE..\"; \n\t putLog \"NOTE: That means: &SYS_PROCHTTP_STATUS_PHRASE..\"; \n\t end; \n\t else do; \n\t putLog 'ERROR: The request to launch the SDA process was most likely not successful.'; \n\t putLog \"ERROR: The HTTP Status Code is &SYS_PROCHTTP_STATUS_CODE..\"; \n\t putLog \"ERROR: That means: &SYS_PROCHTTP_STATUS_PHRASE..\"; \n\t\t\tabort 42;\n\t end; \n\trun;\n%end;\n%else %do;\n\t* HTTP Status Handling - response code not logged to macrovar;\n\tdata _null_; \n\t putLog 'ERROR: The request to launch the SDA process was most likely not successful.'; \n\t putLog \"ERROR: The HTTP Status Code is unknown.\"; \n\t\t\tabort 42;\n\trun;\n%end;\n\n%let _sda_process = '';\n%let _sda_output_directory = '';\n%let _sda_sas_launcher_process_id = '';\n\n%if %sysfunc(fexist(_sda_out)) %then %do;\n\tlibname _sda_out json;\n\t* Check if a output directory that differs from the default was provided;\n\tdata _null_;\n\t set _sda_out.alldata;\n\t if upcase(P1)='ENVIRONMENT' then do;\n\t if upcase(P2)='OUTPUT_DIRECTORY' then call symput('_sda_output_directory', cats(value));\n\t if upcase(P2)='PROCESS' then call symput('_sda_process', cats(value));\n\t\t\tif upcase(P2)=\"SAS_LAUNCHER_PROCESS_ID\" then call symputx(\"_sda_sas_launcher_process_id\",cats(value),'g');\n\t end;\n\trun;\n\n\t* Inform the user about the outcome of the process;\n\tdata work._sda_message_output;\n\t length sda_launcher_message $500;\n\t if \"&_sda_output_directory.\" ne '' and \"&_sda_process.\" ne '' then do;\n\t sda_launcher_message = 'Logs have been routed to ' || \"&_sda_output_directory./&_sda_process./logs\";\n\t output;\n\t sda_launcher_message = 'Output data has been routed to ' || \"&_sda_output_directory./&_sda_process./reports\";\n\t output;\n\t end;\n\t else do;\n\t sda_launcher_message = 'Data and logs have been routed to the default location specified during installation';\n\t output;\n\t end;\n\trun;\n\n\t* Print the launcher information for the user;\n\tproc print data=work._sda_message_output noObs label;\n\t var sda_launcher_message;\n\t\tlabel sda_launcher_message=\"SDA Launcher Message\";\n\tquit;\n\n%end;\n%else %do;\n\tdata _null_; \n\t put 'ERROR: The PROC HTTP response JSON could not be found.';\n\t\t\tabort 42;\n\trun;\n%end;\n\n%global _sda_elapsed_time;\n\n%macro _sda_check_process_status(_sda_start_time=0);\n %if &_sda_start_time = 0 %then %let _sda_start_time = %sysfunc(datetime());\n %let _sda_current_time = %sysfunc(datetime());\n %let _sda_elapsed_time = %sysfunc(round(%sysevalf((&_sda_current_time - &_sda_start_time)/60), 0.01)); /* Convert seconds to minutes */\n\n filename _sda_out clear;\n filename _sda_out temp;\n\n proc http\n method='get'\n url=\"&_sda_viya_host./launcher/processes/&_sda_sas_launcher_process_id./state\"\n oauth_bearer = sas_services\n out=_sda_out;\n headers 'Accept' = 'text/plain';\n quit;\n\n\tdata _null_;\n\t\tcall sleep(5, 1);\n\trun;\n\n\t%if %sysfunc(fexist(_sda_out)) %then %do;\n\t\t%if %symexist(SYS_PROCHTTP_STATUS_CODE) %then %do;\n\t\t data _null_;\n\t\t length status $128.;\n\t\t infile _sda_out;\n\t\t input status $;\n\t\t if &SYS_PROCHTTP_STATUS_CODE. lt 400 then do;\n\t\t if status = 'completed' then do;\n\t\t putLog \"NOTE: SDA process completed successfully.\";\n\t\t end;\n\t\t else if status = 'failed' then do;\n\t\t putLog \"ERROR: SDA process did not complete successfully. Please see SDA batch logs for more information.\";\n\t\t\t\t\t\tabort 42;\n\t\t end;\n\t\t else if %sysevalf(&_sda_elapsed_time >= &_sda_max_wait_time_minutes) and %sysevalf(&_sda_max_wait_time_minutes > 0) then do;\n\t\t putLog \"WARNING: Maximum wait time of &_sda_max_wait_time_minutes minutes reached. Last known process status = \" status;\n\t\t end;\n\t\t else do;\n\t\t * Wait for 5 seconds before making another call;\n\t\t *putLog \"NOTE: Process status = \" status\". Waiting for process to finish.\";\n\t\t call sleep(5, 1);\n\t\t call execute('%_sda_check_process_status(_sda_start_time=&_sda_start_time)');\n\t\t end;\n\t\t end;\n\t\t else do;\n\t\t putLog \"ERROR: The request to check the status of the SDA process was not successful.\"; \n\t\t putLog \"ERROR: The HTTP Status Code is &SYS_PROCHTTP_STATUS_CODE..\"; \n\t\t putLog \"ERROR: That means: &SYS_PROCHTTP_STATUS_PHRASE..\"; \n\t\t\t\t\tabort 42;\n\t\t end; \n\t\t run;\n\t\t%end;\n\t\t%else %do;\n\t\t\t* HTTP Status Handling - response code not logged to macrovar;\n\t\t\tdata _null_; \n\t\t putLog \"ERROR: The request to check the status of the SDA process was not successful.\"; \n\t\t\t putLog \"ERROR: The HTTP Status Code is unknown.\"; \n\t\t\t\t\tabort 42;\n\t\t\trun;\n\t\t%end;\n\t%end;\n\t%else %do;\n\t\tdata _null_; \n\t\t putLog 'ERROR: The PROC HTTP response JSON could not be found.';\n\t\t\t\tabort 42;\n\t\trun;\n\t%end;\n%mend _sda_check_process_status;\n\n%if %str(&_sda_wait_for_completion.) = %str(True) %then %do;\n %_sda_check_process_status();\n%end;\n\n%put _sda_wait_for_completion IS &_sda_wait_for_completion;\n\n* Inform the user about the outcome of the process;\ndata work._sda_message_output;\n length sda_process_message $500;\n\tif \"&_sda_wait_for_completion.\" = \"True\" then do;\n sda_process_message = cat(\"Process executed synchronously in \",\"&_sda_elapsed_time.\",\" minutes\");\n output;\n\tend;\n\telse do;\n sda_process_message = 'Process executed asynchronously. Process may still be running in the background';\n output;\n\tend;\nrun;\n\n* Print the process information for the user;\nproc print data=work._sda_message_output noObs label;\n var sda_process_message;\n\tlabel sda_process_message=\"SDA Process Message\";\nquit;\n\n* Clean up;\nlibname _sda_out clear;\nfilename _sda_out clear;\n%symdel _sda_viya_host _sda_http_request_body _sda_process _sda_sas_launcher_process_id\n\t\t_sda_report_batch_sk_list _sda_report_batch_tag_list\n\t\t_sda_wait_for_completion _sda_elapsed_time;\nproc datasets library=work noList;\n delete _sda_message_output;\nrun; quit;"}}