如何使用两个SAS数据集作为透视数据源,通过SAS程序将两个透视表添加到同一Excel工作表?

时间:2016-08-31 09:31:32

标签: excel vba excel-vba sas

我有两个SAS表,我想从它们在Excel中创建数据透视表。两者必须位于同一张表格中,例如Sheet1

在同一张纸中,我需要创建一个包含基于前两个轴的公式的单元格的表格,例如C3-C10,其中C3是第一个数据透视点的数据点,C10是第二个数据透视点的数据点。

另一个挑战是找出一种方法来格式化和更改工作表中所需的特定行的颜色。

1 个答案:

答案 0 :(得分:0)

This answer is for people that do not have any SAS Office Analytics, or the Office plugin, etc. If you have some of the above tools (which I do not), there is probably a much better approach.

If you find yourself in this situation I suggest that you do the following:

  1. Use SAS to create a CSV file that contains data that will drive the pivots.
  2. Create an excel file that links to data in a CSV file.
  3. Build the two pivots by hand, with the formatting you desire.
  4. Whenever you need to refresh the data, just rerun the SAS job, and then 'refresh' the data in Excel (manually).

This also means you can update the data if people already have the excel file open, so it's suitable for files located on a network etc. Pretty clunky but it will do when no better options are available.