Examining Multiple BY Groups
/*--------------------------------------------------------------
SAS Sample Library
Name: tidex03.sas
Description: Example program from SAS/ETS User's Guide,
The TIMEID Procedure
Title: Examining Multiple BY Groups
Product: SAS/ETS Software
Keys: TIME ID
PROC: TIMEID
Notes:
--------------------------------------------------------------*/
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
04DEC09 1 07DEC09 1 08DEC09 1 09DEC09 1 10DEC09 1 11DEC09 1 14DEC09 1 15DEC09 1
16DEC09 1 17DEC09 1 18DEC09 1 21DEC09 1 22DEC09 1 23DEC09 1 24DEC09 1 25DEC09 1
28DEC09 1 27NOV09 2 01DEC09 2 01DEC09 2 02DEC09 2 03DEC09 2 04DEC09 2 07DEC09 2
08DEC09 2 09DEC09 2 10DEC09 2 11DEC09 2 14DEC09 2 15DEC09 2 16DEC09 2 17DEC09 2
18DEC09 2 21DEC09 2 22DEC09 2 23DEC09 2 24DEC09 2 25DEC09 2 28DEC09 2 29DEC09 2
30DEC09 2 31DEC09 2 02DEC09 3 04DEC09 3 04DEC09 3 07DEC09 3 08DEC09 3 09DEC09 3
10DEC09 3 11DEC09 3 14DEC09 3 15DEC09 3 17DEC09 3 17DEC09 3 18DEC09 3 21DEC09 3
22DEC09 3 23DEC09 3 24DEC09 3 25DEC09 3 28DEC09 3 29DEC09 3 30DEC09 3 31DEC09 3
01JAN10 3 04JAN10 3 05JAN10 3 07DEC09 4 09DEC09 4 09DEC09 4 11DEC09 4 11DEC09 4
14DEC09 4 15DEC09 4 16DEC09 4 17DEC09 4 18DEC09 4 22DEC09 4 22DEC09 4 23DEC09 4
24DEC09 4 25DEC09 4 28DEC09 4 29DEC09 4 30DEC09 4 31DEC09 4 01JAN10 4 04JAN10 4
05JAN10 4 06JAN10 4 07JAN10 4 08JAN10 4
;
proc timeid data=bygroups outintervaldetails=int outinterval=intsum;
id tid;
by by;
run;
data both;
set int intsum;
format start end startshared endshared date.;
run;
proc print data=both noobs;
var by n nintcnts pctintcnts noffsets pctoffsets nspans pctspans status interval
start end seasonality nseasoncycles startshared endshared nby totalseasoncycles seasoncyclesshared;
run;