Segmenting Project Data

Often, you need to partition data into different groups based on the nature of the data (for example, slow moving items, new products, and so on). Segmentation is a process for creating segments that you can run through different modeling nodes in a pipeline.

Defining Project Segments

To segment your data, you first have to define how you want the data segmented. For example, you might want to run different modeling nodes on seasonal products as opposed to products that are sold throughout the year.

After you have your segmentation strategy defined, you need to add the segment definitions to an external attributes data set. As described in Preparing Attributes for Your Project, each row in the external attributes data set must have a unique combination of values of the default attributes. Add a _SEG_ variable to each row to define how you want the data segmented. Each unique value of the _SEG_ variable creates a new segment that is used in segmented pipelines. Each segment name uses the _SEG_ value from the imported attributes. If any rows in the attributes data set has a missing value for _SEG_, the data is placed in a segment named Remaining Series. The _SEG_ variable can take numeric or character values.

SAS Visual Forecasting supports a maximum of 1,000 segments.

The following code provides a simple example for adding segments to the SKINPRODUCT_ATTRIBUTES data set. This data set is available with other sample data sets that you can download, as described in Overview of Data Sources for Forecasting Projects.


cas casauto;                                   /* 1 - Start a CAS session          */
libname mycas cas;                             /* 2 - Create a CAS engine libref   */
options cassessopts=(caslib="Public");      /* 3 - Specify Public as active caslib */

data mycas.segment_attr (promote=yes);         /* 4 - Specify the new data set     */
  set mycas.skinproduct_attributes;            /* 5 - Read in the attributes table */
  length _seg_  $20;                           /* 6 - New variable for segments    */
  if Venue = 'Catalog' then _seg_ ='Catalog';  /* 7 - Assign Segments              */
  if Venue = 'Grocery Store' then _seg_ = 'Grocery Store';            
  if Venue = 'Internet' then _seg_ = 'Internet';                      
  if Venue = 'Outlet Store' then _seg_ = 'Outlet Store';              
  if Venue = 'Third Party Vendor' then _seg_ = 'Third Party Vendor'  ;
run;

This code simply shows how to assign _SEG_ values based on the value of a single variable, Venue. How you segment your project data depends on the characteristics and complexity of your data source, and how you might need to process different segments.

Follow the steps in Importing Attributes to Your Project to add the data set with the segments and attributes to the project.

After the data set with the segment definitions have been added, you can create segmented pipelines to run the project data. For more information, see Working with Segmented Pipelines.

Last updated: March 16, 2026