BookmarkSubscribeRSS Feed

Moving from SAS 9 to Viya: Statistical Procedures

Started yesterday by
Modified yesterday by
Views 58

 

Since your start with SAS, you likely have been utilizing statistical procedures to help you produce analyses for your work. You have your favorites and ones that you have noted will help with that one unique question. Recently, you have received notice that your workplace will be upgrading to Viya. How can you make this transition as smoothly as possible? What resources are there? In this post, we will discuss some resources that are available for you to move from SAS 9 to Viya. We will also look at CAS enabled procedures and CAS action sets and compare them to the SAS procedures of your past.

 

Let’s begin with the headline. Your SAS 9 code will be able to run within Viya using the SAS Studio compute server. The main adjustment you would need to be aware of is the change in the way your libraries, more specifically their location, are conveyed to SAS.

 

But what if you want to utilize the in-memory processing power of CAS? This could be due to the size of your data set or wanting to apply certain types of models that CAS has the advantage of performing. A great starting point for reference is the Syntax Quick Links that are part of the SAS Viya Platform Programming Documentation.

 

01_damodl_blog5_CASPROCSyntax.png

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

 

Let’s focus on the SAS Procedures and Corresponding CAS Procedures and Actions. Within this page, you can explore into topics including Econometrics, Forecasting, Machine Learning, and Statistics. For this post, we will use the Statistics area.

 

02_damodl_blog5_StatsProcMatrix.png

 

On this page, you will see a table that relates some of your favorite SAS 9 procedures to their corresponding CAS enabled procedures and CAS actions. Included is also a CAS action example. For example, many analysts utilize the Logistic procedure. The CAS enabled procedure related to PROC LOGISTIC is LOGSELECT. Likewise, the related CAS actions include nonlinear.nlmod and regression.logistic. With this information, how difficult would it be to transition from your favorite SAS 9 procedures to CAS enabled procedures? Are there any advantages to this transition?

 

Recall the syntax for PROC LOGISTIC. For many, this syntax in engrained into your mind from frequent use.

 

03_damodl_blog5_LogisticSyntax.png

 

How different is the CAS enabled procedure LOGSELECT? Let’s look at the syntax.

 

04_damodl_blog5_logselectsyntax.png

 

Immediately, we see many of the same statements that we are accustomed to with PROC LOGISTIC. Maybe this move to Viya is not as scary than it seems. Is there a way that we can quickly learn about differences between these two procedures? Absolutely!

 

05_damodl_blog5_overview.png

 

When you are at the overview screen of the LOGSELECT procedure, you will notice a subsection titled PROC LOGSELECT Compared with Other SAS Procedures. Clicking on that subsection, you would see LOGSELECT being compared to HPLOGISTIC and LOGISTIC. From a quick read, you would learn that LOGSELECT includes more model selection options that LOGISTIC. This includes the use of LASSO selection, elastic net selection, information-criterion-based selection and stopping criteria, and validation-based criteria.

 

You can find documentation areas like this by following the links to the CAS enabled procedures. You just might learn that your favorite SAS 9 procedure has some additional items if you were to move to the corresponding CAS enabled procedure.

 

While we are talking about CAS enabled procedures, let’s talk about CAS actions. These are the items that are being created and called in the background when you use a CAS enabled procedure. For example, PROC LOGSELECT can call regression.logistic. The name before the dot is the action set and the name after the dot is the action. Multiple actions are grouped into action sets for various reasons.

 

Is it possible that you could write the CAS action directly? Certainly. Let’s look at a logistic example. In the following code, the CAS action is contained within a PROC CAS call. After listing the action set and the action requested, you will type a forward slash. All the remaining items are options for the action. Each statement within the list of options is separated by commas. The selected or listed items for each option are contained within curly braces. For example, the first option is the CLASS option. This lists the variables that are classified as categorical in the analysis. In this example, only the variable C is denoted as categorical. Interesting how this is very similar to your previous usage of a CLASS statement in SAS/STAT modeling procedures. The next option is MODEL. In this example, there are two sub-options within MODEL. The first is DEPVAR. This lists the variable denoted as the response variable in the analysis. The EFFECTS sub-option lists the possible predictor variables for the analysis regardless of categorical or interval. The remaining options control items within the output such as iteration history presented, and tables provided. When you are finished with CAS action, you conclude with a semi-colon.

 

proc cas;
regression.logistic /
class={"C"},
model={depvar="y",
effects={"C", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10"}},
optimization={itHist="summary"},
outputTables={names={parameterestimates="pe"}},
table="getStarted";
run;

 

There are many other options and sub-options available within CAS actions. In some cases, something you might want to be able to perform isn’t currently available in a CAS enabled procedure. In this instance, you can directly go to the CAS action and program it directly.

 

I hope that this helps you in your transition from SAS 9 to Viya and the use of CAS enabled procedures and CAS actions. As you investigate additional items that the CAS enabled procedures can do, please post your favorites in the comments to share with others.

 

 

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
yesterday
Updated by:
Contributors

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 Tags