Published on :
Data Manipulation CREATION_INTERNE

Example: PROC CASUTIL

This code is also available in: Deutsch Español Français
Awaiting validation
The functional analysis demonstrates the use of PROC CASUTIL to interact with the Cloud Analytic Services (CAS) engine. The LOAD statement transfers a SAS© dataset (here, sashelp.cars) to an in-memory CAS table. The 'replace' option ensures that the table is recreated if it already exists. The PARTITION statement is used to filter this CAS table based on conditions specified by the 'where' clause (MSRP greater than 90,000 and Make 'Porsche'), thereby creating a new CAS table. Finally, the ALTERTABLE statement is used to modify the structure of this new table, retaining only the 'make', 'model', and 'MSRP' columns, thus optimizing memory and data relevance. The final PROC PRINT displays the result of these manipulations by accessing the CAS table via the CAS 'mylib' library.
Data Analysis

Type : CREATION_INTERNE


Examples use generated data (datalines) or SASHELP.

1 Code Block
PROC CASUTIL Data
Explanation :
This code initializes a CAS session and a CAS libname. It then loads the 'sashelp.cars' dataset into CAS memory under the name 'cars'. The PARTITION statement filters the 'cars' table to include only cars with an MSRP (Manufacturer's Suggested Retail Price) greater than 90,000 and whose Make is 'Porsche', storing the result in a new table 'carsWhere'. Finally, the ALTERTABLE statement modifies 'carsWhere' to retain only the 'make', 'model', and 'MSRP' columns. The result is then displayed using PROC PRINT.
Copied!
1cas casauto sessopts=(caslib='casuser');
2LIBNAME mylib cas;
3 
4PROC CASUTIL;
5 load DATA=sashelp.cars
6 casout='cars' replace;
7 partition casdata='cars'
8 casout='carsWhere' replace
9 where='MSRP>90000 and Make="Porsche"';
10 altertable casdata="carsWhere"
11 keep={"make", "model", "MSRP"};
12QUIT;
13PROC PRINT DATA=mylib.carsWhere;
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