Published on :
ETL CREATION_INTERNE

PROC CASUTIL: Managing Caslibs and CAS Tables

This code is also available in: Deutsch Español Français
Awaiting validation
PROC CASUTIL is an essential tool for interacting with the CAS environment. It facilitates key operations such as loading data (e.g., from a CSV file), managing caslibs (CAS libraries), and manipulating tables in CAS memory. It allows specifying import options for files and managing table scope (promotion).
Data Analysis

Type : CREATION_INTERNE


The example demonstrates loading a local CSV file that is implicitly created or accessible via a caslib path, making it self-contained in a SAS Viya 4 execution context with provided or simulated data.

1 Code Block
PROC CASUTIL Data
Explanation :
This example illustrates the process of loading a CSV file into a CAS caslib.
1. The first step is to define or add a caslib named `csvfiles` of type `dnfs` (Distributed Network File System) by specifying the path where the CSV files are located. This statement also makes `csvfiles` the active caslib.
2. Next, `proc casutil` is used to list the files available in the active caslib.
3. The `load` command is used to load the `County_Population.csv` file into CAS. The `importoptions` specify that the file is of type CSV and that the first row contains column names (`getnames="true"`). The loaded table is named `county_population` in the active caslib.
4. Finally, `list tables` displays the tables currently loaded in the active caslib, allowing verification of the new table.
Copied!
1caslib csvfiles task=add type=dnfs
2 path="/data/csv/"
3 desc="Spreadsheets and CSV source data;";
4
5PROC CASUTIL;
6 list files;
7 
8 load casdata="County_Population.csv"
9 importoptions=(filetype="csv" getnames="true")
10 casout="county_population";
11 
12 list tables;
13QUIT;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright © SAS Institute Inc. All Rights Reserved.


Banner
Expert Advice
Expert
Simon
Expert SAS et fondateur.
« If you need to refresh data that is already promoted, remember to use droptable before reloading, or use the replace option within the load statement to overwrite the existing in-memory version. »