SAS® Viya™: Load SAS Data from a Libname to a Caslib

  • Archive
  • SAS
This is one of our Amadeus Software archive tips that we’ve kept as its still popular. Some of the information may be out of date. Get in touch if you need more help.

 

 

 

Once you have connected to a CAS session you are able to load data into cas. To perform this task, a snippet is available within SAS Studio named ‘Load data to caslib’.

The snippet contains three sections dependent on the data you would like to load into a caslib. When the data is loaded into a caslib, three options are required on the statement:

  1. Outcaslib – the caslib to load the data into.
  2. Casout – the table name you would like to call the in-memory table within CAS.
  3. Promote – specifies that the data loaded will be available to all active CAS sessions (optional).
    In addition to these three options, each section has additional options which are required to load types of data.

Load SAS Data from a Base Engine Library

The second section allows users to load data from a SAS data set. This can be used to load data from a pre-defined library within SAS into a caslib.

To complete this, the ‘load data’ option is used. This specifies the libname and data set which will be loaded into a caslib.

Load a SAS HELP Data Set into CAS

To demonstrate loading a SAS data set into CAS, we will look at the baseball data set within the SAS HELP library. To load the data, we would modify the default code to the following:

This code loads the baseball data set within the SAS HELP library into the CAS library casuser, with the name BaseballTable. This can be seen within the logs for the run.

If you are a SAS user looking to understand and learn new programming techniques and sintax within the SAS Viya environment our SAS training courses might be right for you.

Back to Insights

Talk to us about how we can help