BookmarkSubscribeRSS Feed
TimCampbell
Quartz | Level 8

Hi everyone,

 

I have a cloud environment with a SAS 9.4 server and also a separate SAS Viya server for running visual analytics.

I want to have a process that:

  • Runs on the SAS 9.4 server to create the data table for my VA report.
  • Sends the data across to the Viya server.
  • Sends an email to alert users that the data is updated.

 

This is an example of the code I have so far for sending data to Viya.

cas casauto;

caslib _all_ assign;

proc casutil incaslib='MYCASLIB' outcaslib='MYCASLIB';

droptable casdata='Report_Table' quiet;

load data=Report_Table casout='Report_Table' replace;

promote casdata='Report_Table';

save casdata='Report_Table';

run;

 

The problem I have is that the Viya server is not turned on 24/7 at the moment so the process throws errors when it's down.

The long term solution will probably be that we need it up 24/7 in line with out prod SAS9.4 server however I would still want to come up with a plan for how to handle things if Viya is down for any reason.

 

Does anyone have any examples of code I could run to check if the viya envrionment is up before I try to send the data across?

Ideally my end goal will be that if Viya is down I want the 9.4 process to send the email saying it's down rather than just the alert that the new data is available.

 

Thanks in advance, 

 

Tim

1 REPLY 1
SASJedi
SAS Super FREQ

A little macro magic should do the trick:

%let CASSTMTERR=0;

cas casauto;

%if &CASSTMTERR ne 0
or %index(%superq(SYSERRORTEXT),session failed)
%then %do; /* Connnection was not successful */ %put NOTE: No connection made.; /* You could also termiante this job */ /* endsas;*/ %end; %else %do; /* Connection successful - do the work */ caslib _all_ assign; proc casutil incaslib='MYCASLIB' outcaslib='MYCASLIB'; droptable casdata='Report_Table' quiet; load data=Report_Table casout='Report_Table' replace; promote casdata='Report_Table'; save casdata='Report_Table'; run; %end;
Check out my Jedi SAS Tricks for SAS Users

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 543 views
  • 2 likes
  • 2 in conversation