Querying and Reading Member Tables in a Dynamic Cluster

You can read the member tables in dynamic clusters by using the MEMNUM= table option. Use the MEMNUM= option to perform query or Read operations on a single member table that belongs to a dynamic cluster. When you use the MEMNUM= option, SPD 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 the dynamic cluster by issuing a CLUSTER LIST statement or PROC CONTENTS on the dynamic cluster. The SPD Server CLUSTER LIST statement or PROC CONTENTS output lists the member tables of the dynamic cluster in numbered order.
The general form for the PROC SPDO CLUSTER LIST command is as follows:
CLUSTER LIST <cluster-tablename> [/VERBOSE];
where<cluster-tablename> is the name of the cluster table to be created/VERBOSE specifies to produce verbose output that contains additional member table information, including MINMAXVARLIST information for each member table in the dynamic cluster.
The general form for the PROC SPDO CLUSTER UNDO command is as follows:
CLUSTER UNDO <cluster-tablename>;
where<cluster-tablename> is the name of the cluster table to undo.
The following example uses PROC SPDO to create a dynamic cluster that has MINMAXVARLIST information about 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.
PROC SPDO library=&libdom;

CLUSTER CREATE ussales
  mem=ne_region
  mem=se_region
  mem=central_region
  
CLUSTER LIST ussales /VERBOSE;
MINMAXVARLIST COUNT=1
varname=store_id
Numeric type.

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

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

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

NOTE: The maximum number of possible slots is 6.
You can specify an integer value n as an argument for the MEMNUM= table option to select the nth member of the table, or you can use the argument LASTCLUSTERMEMBER. When you use the LASTCLUSTERMEMBER argument with MEMNUM=, SPD Server selects the last member of the dynamic cluster table without counting the members to determine the n value of the last member.
The following example uses the MEMNUM= table option to query the member table sales200504, which belongs to the dynamic cluster table sales_history:
PROC SPDO library=&domain;
  CLUSTER CREATE sales_history
   mem=sales200501
   mem=sales200502
   mem=sales200503
   mem=sales200504
   mem=sales200505
   mem=sales200506;
  quit;

 PROC PRINT data=&domain..sales_history (MEMNUM=4);
   WHERE salesdate=30Apr2005;
 run;
The following code uses the MEMNUM= table option to query the last member table in the dynamic cluster table sales200506:
PROC SPDO library=&domain;
  CLUSTER CREATE sales_history
   mem=sales200501
   mem=sales200502
   mem=sales200503
   mem=sales200504
   mem=sales200505
   mem=sales200506;
  quit;

 PROC PRINT data&domain..sales_history
  (MEMNUM=LASTCLUSTERMEMBER);
   WHERE salesdate=15Jun2005;
 run;