Examples use generated data (datalines) or SASHELP.
1 Code Block
PROC CASUTIL
Explanation : The code begins by establishing a CAS session (`cas casauto`) and assigning a library (`libname mylib cas`) to access CAS tables.
The `proc casutil;` statement initializes the CASUTIL procedure.
1. The `load data=sashelp.cars casout='cars' replace;` statement loads the `sashelp.cars` dataset (an internal SAS dataset) into CAS memory under the name 'cars'. The `replace` option ensures that the table is replaced if it already exists.
2. The `partition casdata='cars' casout='carsWhere' replace where='MSRP>90000 and Make="Porsche"';` statement creates a new CAS table named 'carsWhere'. It is created by selecting rows from the 'cars' table where the 'MSRP' value is greater than 90,000 and 'Make' is "Porsche".
3. The `altertable casdata="carsWhere" keep={"make", "model", "MSRP"};` statement modifies the 'carsWhere' table to keep only the 'make', 'model', and 'MSRP' columns.
Finally, `proc print data=mylib.carsWhere;` displays the content of the modified 'carsWhere' CAS table.
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.
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.