The HPFEVENTS Procedure

Using the EVENTKEY Statement

You can use an EVENTKEY statement to make a predefined SAS event available for processing. The EVENTKEY statement constructs a simple SAS event for each predefined SAS event keyword. The predefined SAS events are also available directly through the HPFDIAGNOSE and HPFENGINE procedures. Each predefined event keyword that is specified in the EVENTKEY statement has an associated predefined set of timing values and qualifier-options. The qualifier-options are the same as in the EVENTDEF statement and can be used to redefine the qualifiers that are associated with the predefined event. As shown in the section Getting Started: HPFEVENTS Procedure, the default SAS variable name for the predefined event is the predefined event keyword. However, you can specify a SAS name for the event. For example, the following statement changes the name of the predefined event definition, CHRISTMAS, to XMAS:

eventkey xmas= christmas;

Because any user definition takes precedence over a predefined SAS definition, redefining the qualifiers that are associated with a predefined SAS event but not renaming the event has the impact of redefining the predefined SAS event. The following statements produce the event FALLHOLIDAYS, which has a pulse of one day at Halloween and a pulse of one month at Thanksgiving:

eventkey thanksgiving / pulse=month;
eventcomb fallholidays= halloween thanksgiving;

Predefined SAS events are based on a SAS date keyword, a trend keyword, or an additive outlier or level shift that is based on a timing value. Table 10 describes how to construct a predefined SAS event keyword and shows the default qualifier-options for those predefined events.

You can use an EVENTKEY statement in a similar manner to modify or clone a user-defined simple event. In the following example, the EVENTDEF statement defines a simple event named SPRING, the EVENTKEY statement modifies the SPRING event definition, and then another EVENTKEY statement creates a new event named SPRINGBREAK that is based on the previously defined user event named SPRING. So the example defines a total of two events, SPRING and SPRINGBREAK. (You can use the EVENTKEY statement to modify the qualifiers, but you cannot use it to modify the timing values.)

eventdef spring = '20mar2005'd;
eventkey spring / pulse=day;
eventkey SPRINGBREAK = spring / pulse=week;

Suppose the preceding events are stored in a data set named SPRINGHOLIDAYS. The first EVENTKEY statement in the following example clones SPRING as an event named FirstDayOfSpring. The second EVENTKEY statement changes the case of the SPRINGBREAK event name.

eventdata in=springholidays;
eventkey FirstDayOfSpring = spring;
eventkey Springbreak = springbreak;

Event names that refer to a previously defined event are not case-sensitive. However, the case of event names that are used to create a new event is preserved in the _NAME_ variable of the data set that is specified in the OUT= option in the EVENTDATA statement and in the variable name that is specified in the OUT= option in the EVENTDUMMY statement.

Table 10: Definitions for Predefined Event Keywords in the EVENTKEY Statement

Variable Name or Description Qualifier-Options
Variable Name Format
AO<obs>OBS Outlier TYPE=POINT VALUE=1
AO<date>D BEFORE=(DURATION=0)
AO<datetime>DT AFTER=(DURATION=0)
LS<obs>OBS Level shift TYPE=LS VALUE=1
LS<date>D BEFORE=(DURATION=0)
LS<datetime>DT AFTER=(DURATION=ALL)
TLS<obs>OBS<n> Temporary level shift TYPE=LS VALUE=1
TLS<date>D<n> BEFORE=(DURATION=0)
TLS<datetime>DT<n> AFTER=(DURATION=<n>)
NLS<obs>OBS Negative level shift TYPE=LS VALUE=–1
NLS<date>D BEFORE=(DURATION=0)
NLS<datetime>DT AFTER=(DURATION=ALL)
CBLS<obs>OBS US Census Bureau level shift TYPE=LS VALUE=–1
CBLS<date>D SHIFT=–1
CBLS<datetime>DT BEFORE=(DURATION=ALL)
AFTER=(DURATION=0)
TC<obs>OBS Temporary change TYPE=TC VALUE=1
TC<date>D BEFORE=(DURATION=0)
TC<datetime>DT AFTER=(DURATION=ALL)
<date keyword> Date pulse TYPE=POINT VALUE=1
BEFORE=(DURATION=0)
AFTER=(DURATION=0)
PULSE=DAY
LINEAR Polynomial TYPE=LIN
QUAD Trends TYPE=QUAD
CUBIC TYPE=CUBIC
VALUE=1 BEFORE=(DURATION=ALL)
AFTER=(DURATION=ALL)
The default timing value is the 0 observation.
INVERSE Trends TYPE=INV
LOG TYPE=LOG
VALUE=1 BEFORE=(DURATION=0)
AFTER=(DURATION=ALL)
The default timing value is the 0 observation.
<seasonal Seasonal TYPE=POINT
keywords> PULSE= depends on keyword
VALUE=1 BEFORE=(DURATION=0)
AFTER=(DURATION=0)
Timing values are based on keyword.


The date keywords that are described in Table 3 can be used as predefined SAS event keywords in the EVENTDEF statement. The timing values are defined in Table 3, and the default qualifiers are shown in Table 10. Table 4 shows the seasonal keywords that can be used as predefined SAS event keywords. The default qualifiers for seasonal keywords are shown in Table 10. Table 11 describes in more detail how date and observation numbers are encoded into predefined events when the value of the TYPE= option in the EVENTDEF statement is AO, LS, TLS, NLS, CBLS, or TC.

Table 11: Details for Encoding Date Information into AO, LS, TLS, NLS, CBLS, and TC Type EVENTKEY Variable Names

Variable Name Format Example Refers To
AO<int>OBS AO15OBS 15th observation
AO<date>D AO01JAN2000D ’01JAN2000’D
AO<date>h<hr>m<min>s<sec>DT AO01Jan2000h12m34s56DT ’01Jan2000:12:34:56’DT
TLS<int>OBS<n> TLS15OBS10 15th observation
TLS<date>D<n> TLS01JAN2000D10 ’01JAN2000’D
TLS<date>h<hr>m<min>s<sec>DT<n> TLS01Jan2000h12m34s56DT10 ’01Jan2000:12:34:56’DT


Several types of predefined level shifts are available. The parameter for the negative level shift is the same as the parameter for the level shift, but with the opposite sign. If the parameter for a level shift is negative, then replacing the level shift with a negative level shift results in a positive parameter value. The US Census Bureau level shift is defined in the same manner as the level shift in the US Bureau of the Census X-13ARIMA-SEATS seasonal adjustment program (US Bureau of the Census 2013). The advantage of the US Census Bureau level shift is that as historical observations are dropped and the point of the level shift is no longer within the span of the series, the constant term of the series does not change.

Last updated: March 05, 2026