The TIMEID Procedure

Example 38.3 Examining Multiple BY Groups

This example illustrates how a time ID variable can be examined independently over each BY group and summarized over all observations in the DATA= data set.

data bygroups;
   format tid date.;
   input tid : date. by @@;
datalines;
24NOV09 1 25NOV09 1 26NOV09 1 27NOV09 1 30NOV09 1 01DEC09 1 02DEC09 1 03DEC09 1

   ... more lines ...   

The following TIMEID procedure statements generate two data sets that summarize a data set with four BY groups.

proc timeid data=bygroups outintervaldetails=int outinterval=intsum;
   id tid;
   by by;
run;

The summarized information in Output 38.3.1 shows that BY groups 2, 3, and 4 in the ByGroups data set contain some duplicate values and spans, and group 1 conforms exactly to the WEEKDAY17W interval. This listing also shows that the date ranges in these two BY groups start and end on different days and that they overlap between December 7, 2009, and December 28, 2009.

Output 38.3.1: Selected Variables in the Combined OUTINTERVALDETAILS= OUTINTERVAL= Data Sets

by N NINTCNTS PCTINTCNTS NOFFSETS PCTOFFSETS NSPANS PCTSPANS STATUS INTERVAL START END SEASONALITY NSEASONCYCLES STARTSHARED ENDSHARED NBY TOTALSEASONCYCLES SEASONCYCLESSHARED
1 25 1 0.00 1 0 1 0.00000 0 WEEKDAY17W 24NOV09 28DEC09 5 5 . . . . .
2 25 2 0.08 1 0 2 0.00000 0 WEEKDAY17W 27NOV09 31DEC09 5 5 . . . . .
3 25 2 0.16 1 0 2 0.04348 1 WEEKDAY17W 02DEC09 05JAN10 5 5 . . . . .
4 25 2 0.24 1 0 2 0.13043 1 WEEKDAY17W 07DEC09 08JAN10 5 4 . . . . .
. 100 . . . . . . 1 WEEKDAY17W 24NOV09 08JAN10 5 . 07DEC09 28DEC09 4 6 3