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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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