The ID statement names a numeric variable to associate a sequence value—usually related to a time stamp—to the observations
in the input data set. The observations within a BY group must be ordered in ascending order by the ID variable. Often the
ID variable’s values are SAS date, time, or datetime values, and each observation within a BY group has a unique ID value.
Generally, however, the ID variable can be any numeric variable, and there can be multiple observations with the same ID value.
If the ID values are SAS date, time, or datetime values, you can specify the associated unit of time—for example, day, week
or month—by using the INTERVAL= option. If an ID statement is not specified, the observation number, with respect to the BY
group, is used as the time ID. Whenever an ID variable is specified, a variable, _ID_DELTA_
, is automatically created that can be used as any input data set variable in the programming statements. _ID_DELTA_
contains the distance between two successive ID values. The first _ID_DELTA_
value is arbitrarily taken as one. If the INTERVAL= option is specified, the distance between the ID values is measured in
terms of the number of intervals; therefore, for regularly spaced data, _ID_DELTA_
is identically equal to one. You can specify the following option in the ID statement: