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!
caslib csvfiles task=add type=dnfs
path="/data/csv/"
desc="Spreadsheets and CSV source data;";
proc casutil;
list files;
load casdata="County_Population.csv"
importoptions=(filetype="csv" getnames="true")
casout="county_population";
list tables;
quit;
1
caslib csvfiles task=add type=dnfs
2
path="/data/csv/"
3
desc="Spreadsheets and CSV source data;";
4
5
PROC 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;
13
QUIT;
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.
« 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. »
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.