我使用了以下代码,它运行良好,得到以下结果:
data No_int_weeksPaid;
set no_internet4;
keep account_number week0-week61;
by account_number;
array week{62} week0-week61;
do i = 1 to 62;
if i > subscription_start and i <= (subscription_end+1) then
week{i} = weeks_paid ;
else
week{i} = 0;
end;
drop i;
run;
给了我这样的东西:
Account# Week0 week1 week2 week3 week4
1 0 1 1 1 1
1 0 0 0 5 5
2 1 1 1 1 1
2 0 2 2 2 2
2 0 0 0 4 4
我想将所有帐户#放在一行上并覆盖这些值,以便得到如下内容:
Account# Week0 week1 week2 week3 week4
1 0 1 1 5 5
2 1 2 2 4 4
我认为 by 语句会有所帮助,但没有