SAS® Viya™: Load SAS Data from a Libname to a Caslib
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:
- Outcaslib - the caslib to load the data into.
- Casout - the table name you would like to call the in-memory table within CAS.
- 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.