Hi,
I have a dedicated SAS Server 9.3 T1 (WİNDOWS SERVER 2008) for reporting via web interface coded with Java where users send macro parameters ( such as region code, report name, year, month etc) from combo boxes to SAS programs residing on the server's certain directory. The SAS programme initializes and the results are inserted into Oracle table and final table shown on the webpage.
There are some errors where i need to rollback. I am tcurrently handle this by using a error control macro which basically puts a "NO ERROR" string into my log after SAS code execution is done. Java integration looks into SAS log and searches for that string. If there is a match, it is considered as a successfull process. The warning pop-up is shown on the screen and rollback happens when an error is occured.
My problem is i cannot detect network issues with that/any macro. A session starts, some data steps work properly but connection resets or a TCP socket problem occurs. At that point if there is no parameter sent from web interface, log does not produce a error control macro output (NO ERROR) and programme can't decide wheter it includes errors or not.
How can i detect all errors after my code finishes including syntax, autharization, priveliges, connection time outs or resets etc? I wanna abort the running-programme via this control on SAS or a log output string control on Java.
For more info let me illustrate the scenario:
PARAMETERS FROM JAVA
Report_Name=Sales.sas
Region_code=01
Year=2021
SAS CODE LOCATION ON SERVER = F:\CODES\Sales.sas
SAS CODE
libname TEST oracle user=USER1 pass='xxxxxx' schema=SALE path=SALEDB;
/*lets say connection resets here, after Oracle connection.*/
%let REGION_CODE=%qsysfunc(COMPRESS(PUT(®ION_CODE,z4.)));
%let YEAR=%qsysfunc(compress(&YEAR));
PROC SQL;
CREATE TABLE LOG AS
SELECT T1.*,
MAX(T1.CREATE_DATE) AS VAR3,
CASE WHEN T2.ERROR_ID NE "" THEN "1" ELSE "" END AS CHANGED
FROM TEST.LOCATIONS T1
LEFT JOIN TEST.PROFIT T2 ON(T1.VAR1=T2.VAR1 AND T1.MODEL_NAME=T2.MODEL_NAME AND T1.VAR2=T2.VAR2 )
WHERE T1.REGION_CODE=®ION_CODE
GROUP BY T1.VAR1,
T1.MODEL_NAME,
T1.C_REGION_CODE
HAVING CALCULATED VAR3=T1.CREATE_DATE;
QUIT;
PROC DATASETS LIBRARY=TEST NOLIST;
APPEND BASE=TEST.SALES_TEMP DATA=WORK.LOG FORCE;
RUN;
Thanks in advance, i hope i made it clear. Sorry for the bad explanation.
To deal with network issues or any problems where nothing is returned to your Java interface, I suggest you add a timeout limit in Java, so that if SAS does not return results within a reasonable time limit, you trap this and display an appropriate user message. In this scenario you will no longer have a connection to your back-end SAS session so there is no way to see what has happened to your Oracle table append.
True, however I don't think there is any way to make your process totally bombproof.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.