简体   繁体   English

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

[英]How do I add two pivot tables to the same Excel sheet through a SAS program using two SAS datasets as the pivot data sources?

I have two SAS tables and I want to create pivot tables in Excel from them. 我有两个SAS表,我想从中创建Excel中的数据透视表。 Both must be in the same sheet, say Sheet1 . 两者必须在同一张纸上,例如Sheet1

In the same sheet, I need to create a table that contains cells with formulae based on the first two pivots, eg C3-C10 , where C3 is a data point of the first pivot and C10 from the second pivot. 在同一张纸上,我需要创建一个表,该表包含具有基于前两个枢轴的公式的单元格,例如C3-C10 ,其中C3是第一个枢轴的数据点,而C10是第二个枢轴的数据点。

An additional challenge would be to figure out a way to format and change colours of specific rows as required in the sheet. 另一个挑战是要找到一种方法来按照工作表中的要求格式化和更改特定行的颜色。

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. 此答案适用于没有任何SAS Office Analytics或Office插件等的人。如果您拥有上述工具(我没有),则可能是更好的方法。

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. 使用SAS创建一个CSV文件,其中包含将驱动枢轴的数据。
  2. Create an excel file that links to data in a CSV file. 创建一个excel文件,该文件链接到CSV文件中的数据。
  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). 每当您需要刷新数据时,只需重新运行SAS作业,然后(手动)“刷新” Excel中的数据即可。

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. 这也意味着如果人们已经打开excel文件,则可以更新数据,因此它适用于网络上的文件等。笨拙,但是当没有更好的选择时,它就可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 同一张Excel工作表中的两个数据透视表 - Two Pivot Tables in the same excel sheet 我在同一张表中有两个表。 如何使用 Excel 或 VBA 对齐具有相同数据集的行? - I have two tables in the same Sheet. How do I align rows which have the same set of data using Excel or VBA? 如何使用SAS将2个数据集导出到Excel“ Sheet1”中,以及将另外2个数据集导出到“ Sheet2”中 - How to export 2 datasets in to excel “Sheet1”and another set of 2 datasets into “Sheet2” using SAS 如何使用ODS Excel在SAS中垂直堆叠表? - How do I vertically stack tables in SAS using ODS Excel? 如何根据同一张excel表格上的不同数据透视表创建多个数据透视图? - How to create multiple pivot chart based on different pivot tables on the same excel sheet? 如何将我的VBA数据透视表行数据分成两列而不是同一列? - How do I get my vba pivot table row data into two columns instead of the same column? 将数据透视表从Excel导入SAS EG - Import pivot table from Excel into SAS EG Excel 2016-使用商合并两个数据透视表 - Excel 2016 - Consolidating two pivot tables with quotient 如何在excel中将两个数据透视表合并为一个图表 - How to combine two pivot tables into one chart in excel 在Excel中使用单个切片器控制具有不同数据源的两个数据透视表 - Using single slicer to control two pivot tables with different data source in Excel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM