Previously complex, this operation is now simplified thanks to a specific type of library: the CAS-type Caslib (srcType="CAS").
The Concept: A Bridge Between Two Memories
Traditionally, a caslib points to a physical source (a system folder, an Oracle database, etc.) and loads data into memory.
The novelty here is to define a caslib whose source is not a disk, but the memory of another CAS server.
Imagine you need to migrate in-memory tables from a source environment (e.g., "From35") to a target environment (e.g., "Target"), located in two different namespaces.
Here is the 3-step procedure to perform this transfer cleanly:
On your target environment, you will create a special caslib. It will act as a tunnel to the source environment.
CAS transfersess;
PROC CAS;
/* Création de la caslib 'transfer' qui pointe vers la source */
table.addcaslib /
name="transfer",
dataSource={
srctype="CAS", /* Le type magique */
user="mon_user",
password="mon_password", /* À encoder de préférence ! */
cashost="controller.source-env-host", /* L'adresse du contrôleur source */
caslib="VAModels" /* La caslib source à lire */
};
QUIT;
1
CAS transfersess;
2
PROC CAS;
3
/* Création de la caslib 'transfer' qui pointe vers la source */
4
TABLE.addcaslib /
5
name="transfer",
6
dataSource={
7
srctype="CAS", /* Le type magique */
8
user="mon_user",
9
password="mon_password", /* À encoder de préférence ! */
10
cashost="controller.source-env-host", /* L'adresse du contrôleur source */
11
caslib="VAModels"/* La caslib source à lire */
12
};
13
QUIT;
Note: The cashost corresponds to the hostname of the source CAS controller (retrievable via the CAS configuration).
Step 2: Load the Data into the Target Memory
The tables from the source environment are now visible via the transfer library. You just need to load them into the memory of your final destination library (e.g., VAModels on the target).
PROC CAS;
/* Copie de la table de 'transfer' vers 'VAModels' locale */
table.loadtable /
caslib="transfer"
path="MA_TABLE_SOURCE"
casout={caslib="VAModels", name="MA_TABLE_CIBLE", promote=TRUE};
QUIT;
1
PROC CAS;
2
/* Copie de la table de 'transfer' vers 'VAModels' locale */
The data is now in the new server's memory, but it will disappear upon restart if it is not saved to the local disk of the new environment.
PROC CAS;
/* Écriture physique sur le disque de la cible */
table.save /
caslib="VAModels"
name="MA_TABLE_CIBLE"
table={caslib="VAModels", name="MA_TABLE_CIBLE"}
replace=True;
QUIT;
Die auf WeAreCAS.eu bereitgestellten Codes und Beispiele dienen Lehrzwecken. Es ist zwingend erforderlich, sie nicht blind in Ihre Produktionsumgebungen zu kopieren. Der beste Ansatz besteht darin, die Logik zu verstehen, bevor sie angewendet wird. Wir empfehlen dringend, diese Skripte in einer Testumgebung (Sandbox/Dev) zu testen. WeAreCAS übernimmt keine Verantwortung für mögliche Auswirkungen oder Datenverluste auf Ihren Systemen.
SAS und alle anderen Produkt- oder Dienstleistungsnamen von SAS Institute Inc. sind eingetragene Marken oder Marken von SAS Institute Inc. in den USA und anderen Ländern. ® zeigt die Registrierung in den USA an. WeAreCAS ist eine unabhängige Community-Site und nicht mit SAS Institute Inc. verbunden.
Diese Website verwendet technische und analytische Cookies, um Ihre Erfahrung zu verbessern.
Mehr erfahren.