?>
The `addCaslibSubdir` action creates a new subdirectory within the physical path of an existing caslib. This is particularly useful for organizing data sources and other files within a caslib's storage without needing direct file system access. The action allows specifying permissions for the new subdirectory, ensuring proper access control from the moment of creation.
| Parameter | Description |
|---|---|
| caslib | Specifies the name of the caslib where the subdirectory will be created. This parameter is required to identify the target storage location. |
| path | Specifies the name of the subdirectory to create. The path is relative to the root directory of the specified caslib. This parameter is mandatory. |
| permission | Specifies the file system permissions for the new subdirectory using either a descriptive string (e.g., 'PUBLICREAD', 'PRIVATE') or an octal integer representation. If omitted, the default permissions are determined by the umask of the CAS server process. |
Before creating a subdirectory, we first need a caslib. This code sets up a new caslib named 'myCaslib' pointing to a specific path on the CAS server's file system. Ensure the specified path exists and the server has the necessary permissions.
proc cas; caslib myCaslib path='/cas/data/casuser' dataSource={srcType='path'}; run;This example demonstrates the most basic usage of the `addCaslibSubdir` action. It creates a new subdirectory named 'new_data_folder' inside the 'myCaslib' caslib with default permissions.
| 1 | PROC CAS; TABLE.addCaslibSubdir / caslib='myCaslib' path='new_data_folder'; RUN; |
This example creates a subdirectory named 'shared_reports' within the 'myCaslib' caslib. It explicitly sets the permissions to 'GROUPWRITEPUBLICREAD', which allows the owner and the group to read and write, while others can only read.
| 1 | PROC CAS; TABLE.addCaslibSubdir / caslib='myCaslib' path='shared_reports' permission='GROUPWRITEPUBLICREAD'; RUN; |
After creating a subdirectory, you can verify its existence by using the `fileInfo` action. This example first creates a directory 'project_alpha' and then lists the contents of the caslib's root to confirm the new directory is present.
| 1 | PROC CAS; TABLE.addCaslibSubdir / caslib='myCaslib' path='project_alpha'; |
| 2 | TABLE.fileInfo / caslib='myCaslib'; RUN; |
A marketing department needs to structure its data for a new campaign. They require a dedicated, secure subdirectory within their main caslib to store customer lists, creative a...
A data governance team is stress-testing the CAS environment to ensure system integrity and security. They must verify that the `addCaslibSubdir` action fails gracefully and pro...
An automated ETL process needs to create a unique subdirectory for each day's data load within an 'ingestion' caslib. This scenario tests the action's performance and reliabilit...