简体   繁体   中英

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. Both must be in the same sheet, say 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM