To my disappointment, the following code, which sums up 'value' by week from 'master' for weeks which appear in 'transaction' does not work -

```
data master;
     input week value;

datalines;
1 10
1 20
1 30
2 40
2 40
2 50
3 15
3 25
3 35
;
run;

data transaction;
     input change_week ;

datalines;
1
3 
;
run;

data _null_;

    set transaction;

    do until(done);
        set master end=done;
        where week=change_week;

        sum = sum(value, sum);
    end;

    file print;
    put week= sum=;

run;

```

SAS complains, rightly, because it doesn't see 'change\_week' in master and does not know how to operate on it.

Surely there must be a way of doing some operation on a subset of a master set (of course, suitably indexed), given a transaction dataset... Does any one know?