
'year with 52 weeks

for !y=2000 to 2001
         for !m=1 to 9
                       for !w=1 to 9
                              series d_{!y}_0{!m}_0{!w} = 0   
                                  for !m2=10 to 12
                                        for !w2=10 to 52
                                               series d_{!y}_{!m2}_{!w2} = 0
                                         next
                                 next
                        next
          next
next

for !y=2000 to 2001
              for !m=1 to 9
                     for !w=1 to 9
                           smpl if @year=!y and @month=!m  and @datepart(@date, "ww")=!w
                                series d_{!y}_0{!m}_0{!w} = 1
smpl @all 
                                      for !m2=10 to 12
                                           for !w2=10 to 52
                                                 smpl if @year=!y and @month=!m and @datepart(@date, "ww")=!w2
                                                     series d_{!y}_{!m2}_{!w2} = 1
smpl @all
                                           next
                                   next
                     next
             next
next

' year with 53 weeks

for !y=2000 to 2001
         for !m=1 to 9
                       for !w=1 to 9
                              series d_{!y}_0{!m}_0{!w} = 0   
                                  for !m2=10 to 12
                                        for !w2=10 to 53
                                               series d_{!y}_{!m2}_{!w2} = 0
                                         next
                                 next
                        next
          next
next

for !y=2000 to 2001
              for !m=1 to 9
                     for !w=1 to 9
                           smpl if @year=!y and @month=!m  and @datepart(@date, "ww")=!w
                                series d_{!y}_0{!m}_0{!w} = 1
smpl @all 
                                      for !m2=10 to 12
                                           for !w2=10 to 53
                                                 smpl if @year=!y and @month=!m and @datepart(@date, "ww")=!w2
                                                     series d_{!y}_{!m2}_{!w2} = 1
smpl @all
                                           next
                                   next
                     next
             next
next
group dum d*
