Adds a new caslib to enable access to a data source. A caslib is an in-memory space to hold tables, access control lists, and data source information. Caslibs provide a way to organize in-memory tables and to manage access to data. All data is available to CAS through caslibs, and all operations in CAS that use tables are performed with caslibs.
| Parameter | Description |
|---|---|
| activeOnAdd | When set to True, the new caslib becomes the active caslib. Default: TRUE. |
| createDirectory | When set to True, the caslib directory will be created. Default: FALSE. |
| dataSource | Specifies the data source type and type-specific parameters. The value for srcType determines which other parameters are applicable. |
| description | Specifies a description for the caslib. |
| hidden | When set to True, the caslib will be a hidden caslib. Default: FALSE. |
| name | Specifies the name of the caslib to add. This is a required parameter. |
| path | Specifies data source-specific information. For PATH and DNFS types, this is a file system path. |
| permission | Specifies the host access controls on the caslib when directory creation is requested. By default, permissions are set by the umask of the session process. |
| session | When set to True, the caslib is scoped to the current session only. Tables loaded in this session cannot be accessed from other sessions. If False, the caslib is visible to other sessions, subject to access controls. Default: TRUE. |
| subDirectories | When set to True, tables and files in subdirectories of the path are accessible from the caslib. Default: FALSE. |
| tableRedistUpPolicy | Specifies the default Table Redistribution Policy for tables in this caslib when the number of worker pods increases. |
| transient | When set to True, the caslib will be a transient caslib, meaning it will not persist after the session ends. Default: FALSE. |
No specific data creation is needed for the addCaslib action itself, as it is used to define a data source location. The examples assume that the specified paths or database connections are valid.
| 1 | /* No |
| 2 | data creation step is necessary for addCaslib. Ensure the target path or database exists. */ |
This example demonstrates how to add a basic caslib named 'MyPathCaslib' that points to a directory on the file system. This is the most common type of caslib for accessing files like SASHDAT, CSV, or Parquet files. The 'session=false' parameter makes it available to other sessions.
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.addCaslib / name="MyPathCaslib" path="/path/to/your/ |
| 4 | data" dataSource={srcType="PATH"} |
| 5 | SESSION=false; |
| 6 | |
| 7 | RUN; |
| 8 | |
| 9 | QUIT; |
| 10 |
This example shows how to add a caslib to connect to an Oracle database. It specifies the data source type as 'ORACLE' and includes necessary connection parameters like the server path, user, password, and schema. This allows CAS to directly query and load data from the Oracle database.
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.addCaslib / name="MyOracleCaslib" dataSource={srcType="ORACLE", path="oracle-server.example.com", user="myuser", password="mypassword", schema="myschema"} |
| 4 | SESSION=false; |
| 5 | |
| 6 | RUN; |
| 7 | |
| 8 | QUIT; |
| 9 |
This example creates a session-level caslib named 'TempData'. The 'session=true' parameter ensures the caslib is automatically dropped when the session ends. The 'subDirectories=true' option allows access to files in subfolders of the specified path, which is useful for organizing large datasets.
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.addCaslib / name="TempData" path="/tmp/cas/tempdata" dataSource={srcType="PATH"} |
| 4 | SESSION=true subDirectories=true; |
| 5 | |
| 6 | RUN; |
| 7 | |
| 8 | QUIT; |
| 9 |
A marketing team needs to analyze new customer campaign data stored in a CSV file within an Amazon S3 bucket. The goal is to create a session-scoped caslib to load and analyze t...
A data engineering team is establishing a central data lake on a Distributed Network File System (DNFS). The caslib must be global (not session-scoped), persistent, and provide ...
A new user is attempting to create a personal, transient caslib for temporary data storage. They first specify a path that does not exist, testing the system's behavior. Then, t...