Querying and Reading Member Tables in a Dynamic Cluster

You can read specific member tables in a dynamic cluster table by using the MEMNUM= table option. The MEMNUM= table option takes a number that indicates the member table’s position in the member table list or the literal LASTCLUSTERMEMBER. When you use the MEMNUM= option, the server opens only the specified member table, instead of opening all of the member tables that belong to the dynamic cluster.
You can determine the member number of a table in a dynamic cluster table by submitting the CLUSTER LIST statement to the server or by using PROC CONTENTS on the dynamic cluster table. Both methods list the member tables of the dynamic cluster.
The general form for the CLUSTER LIST statement is as follows:
CLUSTER LIST cluster-table-name
<OUT=output-SAS-table-name>
</VERBOSE>;
cluster-table-name
the name of the dynamic cluster table for which you want to see the member list.
<OUT=output-SAS-table>
(optional) writes the results of the CLUSTER LIST statement to an output SAS table of the specified name. The table is written to the SAS Work library. To create the table in a different location, specify a Base engine libref. By default, the CLUSTER LIST statement creates output columns Cluster Name and Member Name.
</VERBOSE>
By default, the CLUSTER LIST statement returns the cluster table name and member names. Specifying /VERBOSE adds columns for Column Name, Minimum Value, and Maximum Value to the output table.
The following example code uses PROC SPDO to generate a list of the member tables in the dynamic cluster table Sales_History, and writes the output to a SAS table named MyLib.OutFile.
proc spdo library=libref;
cluster list Sales_History out=mylib.outfile;
The following example code uses PROC SPDO to create the dynamic cluster table UsSales. The candidate member tables (Ne_Region, Se_Region, and Central_Region) have the MINMAXVARLIST attribute defined on the numeric column Store_ID in each member table. Then, a CLUSTER LIST statement is issued with the /VERBOSE option. The CLUSTER LIST output displays the dynamic cluster name, the names of each member table in the dynamic cluster, and the MINMAXVARLIST information for each member table. The output data set is written to a SAS library named MyLib.
proc spdo library=libref;
 cluster create ussales
 mem=ne_region
 mem=se_region
 mem=central_region;
  
cluster list ussales out=mylib.outfile /VERBOSE;
MINMAXVARLIST COUNT=1
varname=store_id
Numeric type.

Cluster Name USSALES, Mem=NE_REGION
  Column Name  (MIN,MAX)
  STORE_ID       ( 1, 20)

Cluster Name USSALES, Mem=SE_REGION
  Column Name  (MIN,MAX)
  STORE_ID       ( 60, 70)

Cluster Name USSALES, Mem=CENTRAL_REGION
  Column Name (MIN,MAX)
  STORE_ID      ( 60, 70)

NOTE: The maximum number of possible slots is 6.
Here is the output:
Output from the CLUSTER LIST Statement
The following code uses the MEMNUM= table option with a number:
proc print data=mylib.ussales (MEMNUM=2);
 run;
The following code uses the MEMNUM= table option to query the last member table in the dynamic cluster table ussales:
proc print data=mylib.ussales
  (MEMNUM=LASTCLUSTERMEMBER);
   run;
Last updated: February 8, 2017