Creating Event Definitions

SAS Visual Forecasting includes a list of predefined eventsan incident that disrupts the normal flow of any process that generates the time series. Examples of events are holidays, retail promotions, and natural disasters.. However, you might need to add to this list of events or create a customized list of events for your company.

Use one of the following methods to create your own events.

To create events using the HPFEVENTS procedure, follow these steps.

  1. In the upper left corner of SAS Viya, click the Show applications menu icon and select Develop Code and Flows.
  2. Create an events data set using HPFEVENTS procedure. Here is an example.

    HPFEVENTS Procedure

    
    proc hpfevents data=sashelp.air lead=12;        /* 1*/
       id date interval=month;
       eventdef fallpromo=    '01oct2018'd ;        /* 2*/
       eventdef back2school=  '07aug2018'd to '30aug2018'd by day;
       eventdef superbowl =   '06FEB2011'D  '05FEB2012'D  '03FEB2013'D  
                              '02FEB2014'D  '01FEB2015'D  '07FEB2016'D  
                              '05FEB2017'D  '04FEB2018'D  '03FEB2019'D  
                              '02FEB2020'D  '07FEB2021'D  '13FEB2022'D  
                              '05FEB2023'D  '11FEB2024'D  '09FEB2025'D; 
       eventdata out=eventds (label='Event List');  /* 3*/
    run;
    
    
    1. The DATA option requires a sorted input data set. For this example, sashelp.air is used because it is already sorted. The goal of this step is to get the output data set with event definitions. Any sorted data set is sufficient.

    2. Use the EVENTDEF statement for each custom event definition. Each definition is in the form of SAS-variable-name=timing-value-list.

      In this case, the fallpromo defines a single date. Most events are likely to be repeated, such as the superbowl definition. Since the Superbowl is always on a Sunday, there is a specific date for each year. The back2school event definition spans each day from August 7 to August 30. Like fallpromo, this event is defined only for a single year. Adding another fallpromo event for the following year would require another definition.

      The event definition can also include optional qualifier-options. See the SAS Forecast Server Procedures User's Guide for more information about event definitions.

    3. The event definition table is created by specifying the data set name using the OUT option in the EVENTDATA statement.

      Note: Do not use the CONDENSE option in the EVENTDATA statement. This can cause errors when trying to import the event definition to a project.

After creating the event definition table, you can add the events to any project as described in Importing Custom Events.

For more information about defining events using the EVENTDEF statement or using the HPFEVENTS procedure, see The HPFEVENTS Procedure in the SAS Forecast Server Procedures User's Guide.

Last updated: March 16, 2026