我有一系列交易,每个交易都表明购买了多少单位。例如,我有
我想复制Bud Light 3次和Miller Light 2次:
换句话说,我需要创建尽可能多的单个购买条目,如我的一个列中所示的购买次数。
我该怎么做?感谢任何输入。
答案 0 :(得分:1)
有一个命令就是这样做的。
查看expand
描述
expand replaces each observation in the dataset with n copies of the observation, where n is equal to the
required expression rounded to the nearest integer. If the expression is less than 1 or equal to missing,
it is interpreted as if it were 1, and the observation is retained but not duplicated.