如果指定了count,则多次显示观察值

时间:2014-02-19 01:21:54

标签: sas

我有以下输入

FromCount ToCount  FromStore ToStore 
3          1       Macy's    Wallmart
1          3       JcPenny   Frys
3          2       Frys      Wallmart

这是所需的输出

输出

FromStore   ToStore  
Macy's      Wallmart
Macy's      Wallmart
Macy's      Wallmart
JcPenny     Fry's
JcPenny     Fry's
JcPenny     Fry's
Frys      Wallmart
Frys      Wallmart
Frys      Wallmart
Frys      Wallmart
Frys      Wallmart
Frys      Wallmart

我有这段代码:

do i=1 to (FromCount*ToCount);
output;
end;

但该代码不起作用。

1 个答案:

答案 0 :(得分:0)

您需要在数据步骤中执行此操作。

data output(keep=FromStore ToStore);
set input;

do i=1 to (FromCount*ToCount);
   output;
end;

run;