When working in SAS Viya, the most common performance bottleneck is the unnecessary movement of data between the Compute Server and the CAS Server. While a traditional DATA step is versatile, it often requires "pulling" data out of the cloud to process it.
By using PROC CASUTIL, you unlock Server-Side Processing. Statements like PARTITION and ALTERTABLE execute entirely within the distributed CAS environment. This means your data never leaves the high-speed in-memory layer. Specifically, using ALTERTABLE with the keep= parameter is an "expert move" for memory management; it allows you to prune unnecessary columns from a table without the overhead of a full data rewrite. For massive datasets, this approach isn't just a best practice—it's the only way to ensure your cloud resources remain optimized and your execution times stay in the seconds rather than minutes.
Type : CREATION_INTERNE
Examples use generated data (datalines) or SASHELP.
| 1 | cas casauto sessopts=(caslib='casuser'); |
| 2 | LIBNAME mylib cas; |
| 3 | |
| 4 | PROC 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"}; |
| 12 | QUIT; |
| 13 | PROC PRINT DATA=mylib.carsWhere; |