BookmarkSubscribeRSS Feed

_Status: The CAS Action “Return Code”

Started ‎05-27-2021 by
Modified ‎05-27-2021 by
Views 6,467

We've covered CASL Result variables and the CASL _Perf variable. So let's move on to the CASL _Status variable. Like the _Perf variable, the _Status variable is set/updated after each CAS Action execution, and, like the _Perf variable, the _Status variable is a CASL dictionary. It includes the following attributes:

 

  • severity
  • reason
  • status
  • statusCode

The severity tells us whether or not the CAS action was successful, 0 for success, 1 for warning, and 2 for error. While the other attributes add detail about the status. See here for the documentation. .

 

Simple _Status Example

Looking at a simple example, we see we can print _Status just like we printed _Perf in this previous post. You can also give the _Status variable a different name using the Status= CAS action option ('status=s' in the example). This can be useful if you want to create a complex condition on the status of more than one CAS action.

 

ssf_1_tatus-1.png

 

A Simple Example of _Status

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

 

Conditional Execution based on _Status

Using CASL conditional programming, CAS Action Status information can help give CASL scripts fault-handling capabilities. For example, below we see a simple script that checks the table load status before running some analytics.

 

sf_2_status1-2.png

 

Simple Conditional CASL _Status Code

 

Want More CASL?

For more on CASL programming, see the following links. 

 

Find more articles from SAS Global Enablement and Learning here.

Comments

Is there a way to return a bad syscc / sysrc code from the PROC CAS?

Hi hrczeglo, you'll have to do something like below.  We use the status=s option to put the _status info into the s CASL variable and then we use symputx function to put the _status statusCode in the syscc macro variable.  

 


proc cas;
simple.summary result=r status=s /
inputs={"actual","predict"}
subset={"sumb"}
table={name="prdsale" caslib="dm" groupby={"prodtype"}}
casout={name="prdsaleSum" caslib="dm" replace="true" replication=0};
print _status;
call symputx('syscc', s.statusCode, 'G');
quit;

%put ***syscc is &syscc.***;   

 The above example fails because the "sumb" variable does not exist and the "print _status" and "%put ***sycc is &syscc.***; statement outputs look like this:  

 

{severity=2,reason=6,status=Error parsing action parameters.,statusCode=2720411}
NOTE: PROCEDURE CAS used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds

90
91 %put ***syscc is &syscc.***;
***syscc is 2720411***
Version history
Last update:
‎05-27-2021 11:30 AM
Updated by:
Contributors

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Labels
Article Tags