The PARTITION Procedure

PROC PARTITION Statement

  • PROC PARTITION <options>;

The PROC PARTITION statement invokes the procedure.

You can specify the following options for all types of sampling:

APPLYROWORDER

uses a data distribution and row order as determined by a previous partition action call. For more information, see the section The APPLYROWORDER Option in Chapter 2, Shared Concepts.

DATA=CAS-libref.data-table

names the input data table for PROC PARTITION to use. CAS-libref.data-table is a two-level name, where

CAS-libref

refers to a collection of information that is defined in the LIBNAME statement and includes the caslib, which includes a path to the data, and a session identifier, which defaults to the active session but which can be explicitly defined in the LIBNAME statement. For more information about CAS-libref, see the section Using CAS Sessions and CAS Engine Librefs.

data-table

specifies the name of the input data table.

NTHREADS=number-of-threads

specifies the number of threads to be used. The default is the CPU count on each node.

PARTIND

adds to the output data table a partition indicator, _PartInd_, which indicates whether an observation is selected to a partition (1 or 2) or not (0).

SEED=random-seed

specifies an integer that is used to start the pseudorandom number generator. If you do not specify a seed or you specify a value less than or equal to 0, the seed is generated from reading the time of day from the computer’s clock. The SEED= option enables you to reproduce the same sample output.

You can specify the following options only for simple random sampling and stratified sampling:

SAMPPCT=sample-percentage

specifies what percentage of the data is to be sampled, where sample-percentage is a positive number less than or equal to 100. For example, SAMPPCT=50.5 samples 50.5% of data. When you specify this option along with the PARTIND option, the percentage of the sample whose _PartInd_ is 1 is specified in sample-percentage, and the percentage of the sample whose _PartInd_ is 0 is 100 minus sample-percentage.

SAMPPCT2=sample-percentage-2

partitions the input data into three parts when specified along with the SAMPPCT= and PARTIND options. The percentage of the sample whose _PartInd_ is 1 is specified in the SAMPPCT= option, the percentage of the sample whose _PartInd_ is 2 is specified in the SAMPPCT2= option, and the percentage of the sample whose _PartInd_ is 0 is 100 minus the sum of the values of the SAMPPCT= and SAMPPCT2= options. The sum of the sample-percentages specified in the SAMPPCT= and SAMPPCT2= options must be a positive number less than or equal to 100.

The following formulas are used to calculate sample sizes for partitions:

n equals normal r normal o normal u normal n normal d left-parenthesis left-parenthesis sans-serif-italic sample hyphen percentage plus sans-serif-italic sample hyphen percentage hyphen 2 right-parenthesis times upper N right-parenthesis
n 1 equals normal r normal o normal u normal n normal d left-parenthesis left-parenthesis sans-serif-italic sample hyphen percentage slash left-parenthesis sans-serif-italic sample hyphen percentage plus sans-serif-italic sample hyphen percentage hyphen 2 right-parenthesis right-parenthesis times n
n 2 equals n minus n 1

where N is the number of observations in the input data, n is the total number of observations in the partitions, n 1 is the number of observations in the first sample, and n 2 is the number of observations in the second sample.

You can specify the following options only for oversampling:

EVENT="rare-event-level"

specifies the level (category) that corresponds to a rare event of the variable that is specified in the BY statement. If you have a format applied to the variable, you should specify the formatted event level in this option. If you specify this option, PROC PARTITION uses an oversampling technique to adjust the class distribution of the data, and the following two options are required.

EVENTPROP=event-proportion

specifies the proportion of rare events that you want in the sample, where event-proportion is a positive number less than or equal to 1. For example, EVENTPROP=0.3 specifies that 30% of the sample are rare events and 70% are not rare.

SAMPPCTEVT=sample-event-percentage

specifies the sample percentage from the rare event level, where sample-event-percentage is a positive number less than or equal to 100. For example, SAMPPCTEVT=50.5 specifies that you want to sample 50.5% of the rare events.

You can specify the following option only for k-fold partitioning:

KFOLD=k

specifies the number of folds you want to partition the data into, where k is a positive integer greater than or equal to 2.

Last updated: September 13, 2022