cloud login

Promote data to a Project CASLIB (SAS Studio)

The script below shows the difference between promoting a SAS dataset from a fileserver library (WORK) and from a CAS library (CASUSER). It is useful to know both ways for several reasons:

  • CAS libraries handle very large datasets better than fileserver libraries (higher memory limit and speed)

  • However some functions do not work properly on a CASLIB dataset, which forces you to work in a fileserver library

/*
    Author: Paul Koot
    Created on: 2022/01/06
    Goal script: Show differences into loading and promoting data in-memory (to CASLIB 
    named 'SHARED') from:
     1. fileserver library (WORK)
     2. CAS library (CASUSER)
    Dependencies: - */

/* Initiate CAS session to be able to access the CASLIBS */
cas MySession;
caslib _all_ assign;

/* Load sample dataset into local WORK for this demo */
data WORK.class;
    set SASHELP.class;
run;

/*=================================================
    1. DROP ORIGINAL TABLE IN TARGET CASLIB, 
    2. LOAD AND PROMOTE WORK TABLE AND
    3. SAVE A .SASHDAT FILE TO THE SERVER (CASE SENSITIVE!)
 *===============================================*/

proc casutil;
droptable incaslib="SHARED" casdata="class" quiet;
load data=WORK.class outcaslib="SHARED" casout="class" promote;
save incaslib="SHARED" casdata="class" outcaslib="SHARED" casout="class" replace;
quit;

/* Load sample dataset into local CASUSER for this demo */
data CASUSER.class;
    set SASHELP.class;
run;

/*=================================================
    1. DROP ORIGINAL TABLE IN TARGET CASLIB, 
    2. LOAD AND PROMOTE CASUSER TABLE (THIS LINE IS DIFFERENT THAN FOR WORK) AND
    3. SAVE A .SASHDAT FILE TO THE SERVER (CASE SENSITIVE!)
 *===============================================*/

proc casutil;
droptable incaslib="SHARED" casdata="class" quiet;
promote incaslib="CASUSER" casdata="class" outcaslib="SHARED" casout="class";
save incaslib="SHARED" casdata="class" outcaslib="SHARED" casout="class" replace;
quit;

cas MySession terminate;

// Contact

Notilyze B.V.
Stationsplein 45 A4.004
3013 AK Rotterdam
+31 10 798 62 95
info@notilyze.com

// Ask a question