Here's your solution, not ideal because of the size of the dataset but this will work. As far as I know you can't do this in one step, you'll have to break it down like this. data have; infile cards dsd; informat date mmddyy10.; format date weekv5.; input product$ model$ date sales; cards; 1,001,01/01/1990,300 1,001,01/02/1990,100 1,001,01/03/1990,100 1,001,01/04/1990,200 1,001,01/05/1990,300 1,001,01/06/1990,100 2,001,01/05/1990,222 2,001,01/06/1990,333 2,002,01/07/1990,555 2,002,01/08/1990,444 2,003,01/09/1990,999 2,003,01/10/1990,444 3,001,01/05/1990,222 3,002,01/06/1990,777 3,003,01/06/1990,300 3,004,01/07/1990,800 3,005,01/08/1990,500 3,006,01/09/1990,666 ; data prep; set have; date_c = input(put(date,weekv5.),$5.); run; proc sql; create table want as select distinct product,model,date,sales,avg(sales) as average from prep group by product,model,date_c;
... View more