Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

SAS® Viya™: Load a CSV File 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'.

SAS Viya Load a CSV to Caslib Image 1

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

Option  Description
Outcaslib  The caslib to load the data into.
Casout  The table name you would like to call the in-memory table within CAS.
Promote (Optional) Specifies that the data loaded will be available to all active CAS sessions.

In addition to these three options, each section has additional options which are required to load specific types of data.

Load file from a client location

The first section within the snippet allows users to load data directly from a directory on the SAS Viya server.

SAS Viya Load a CSV to Caslib Image 2

To load a file from a client location the 'load file' option is required. This option specifies the file which you would like to load into the caslib, within double quotation marks.

Load a CSV file into CAS

To demonstrate how to load a CSV file into CAS,
To load a CSV file into CAS, the 'importoptions' option is required. This specifies the file type which we would like to import into CAS, in the following example we have specified that this is a csv file.

SAS Viya Load a CSV to Caslib Image 3

The following file types can also be read into CAS directly:

  • Basesas
  • Dta
  • Excel
  • Hdat
  • Lasr
  • Xls

When the code is run, the log details that the CSV file has been loaded into CAS sucessfully.

SAS Viya Load a CSV to Caslib Image 4