BookmarkSubscribeRSS Feed

_Status: The CAS Action “Return Code”

Started ‎05-27-2021 by
Modified ‎05-27-2021 by
Views 5,410

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.




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.




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.


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 /
table={name="prdsale" caslib="dm" groupby={"prodtype"}}
casout={name="prdsaleSum" caslib="dm" replace="true" replication=0};
print _status;
call symputx('syscc', s.statusCode, 'G');

%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

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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags