首页 > 解决方案 > 如何一次转置多列?

问题描述

我试图用两个变量转置三列。

我当前的数据集如下所示:

 Person     Date    Company      Industry       Number 
  John      2017     Apple       Tech            5
  John      2017    Starbucks    Beverages       3
   Kim      2014      Hilton     Hotels          9

我希望我的输出数据集看起来像:

 Person | Date | Company1 | Industry1 | Number1 | Company2 |Industry2| Number2

  John  | 2017 |  Apple   |   Tech    |  5      | Starbucks| Beverage| 3
  Kim   | 2014 |   Hilton |  Hotels   |  9      |     -    |    -    |  -

如您所见,我希望每个观察的名称和日期都是唯一的。

有什么建议么?

标签: sastransposeproc

解决方案


推荐阅读