<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Excel 2016 SAS Add-In: Replacing SAS Dataset without Losing Formula Reference to Dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Excel-2016-SAS-Add-In-Replacing-SAS-Dataset-without-Losing/m-p/777017#M31435</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have SAS Add-In 8 installed for Excel 2016. On an Excel 2016 workbook, I have several worksheets which source SAS Datasets, see a picture below for a cropped example of one particular dataset.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dataset 1.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65134iF7D58AAB827D2891/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dataset 1.jpg" alt="Dataset 1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Elsewhere in the workbook, I have cells with formulas that refer to the SAS dataset via a table reference. For example, the formula reads:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=SUMIFS(RUS20_SOLAR[LFS20_SolarOutput_kW],RUS20_SOLAR[Cooperative],Input!$B$1,RUS20_SOLAR[year],'Exhibit 15'!$A10,RUS20_SOLAR[month],'Exhibit 15'!B$7)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where&amp;nbsp;&lt;EM&gt;RUS20_SOLAR&amp;nbsp;&lt;/EM&gt;is the name of the table in Excel and is the SAS dataset pictured.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I seek to replace the SAS datasets with new SAS datasets (as an example, replace RUS20_SOLAR with a new dataset but having the same column structure) while maintaining the same formula reference. When I attempt to do this manually I try two options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I attempt to replace the &lt;EM&gt;RUS20_Solar&lt;/EM&gt; table with my intended dataset by placing it in the location of the&amp;nbsp;&lt;EM&gt;RUS20_Solar&lt;/EM&gt; table (see picture).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Overwrite1.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65135iCAC39CE6A68947C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Overwrite1.jpg" alt="Overwrite1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, after clicking OK, I am given an error, "The specified output location already contains content. Please select a different location."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second option is I go to Manage Content and delete the table.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Delete1.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65136i2390FBCFB71DBF0E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Delete1.jpg" alt="Delete1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As soon as it is deleted, the formula becomes:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=SUMIFS(#REF!,#REF!,Input!$B$1,#REF!,'Exhibit 15'!$A10,#REF!,'Exhibit 15'!B$7)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;indicating the references to the&amp;nbsp;&lt;EM&gt;RUS20_Solar&lt;/EM&gt; table have been lost.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a workaround to this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if I can clarify. I appreciate any feedback and assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Oct 2021 15:46:36 GMT</pubDate>
    <dc:creator>sasforumuser</dc:creator>
    <dc:date>2021-10-28T15:46:36Z</dc:date>
    <item>
      <title>Excel 2016 SAS Add-In: Replacing SAS Dataset without Losing Formula Reference to Dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Excel-2016-SAS-Add-In-Replacing-SAS-Dataset-without-Losing/m-p/777017#M31435</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have SAS Add-In 8 installed for Excel 2016. On an Excel 2016 workbook, I have several worksheets which source SAS Datasets, see a picture below for a cropped example of one particular dataset.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dataset 1.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65134iF7D58AAB827D2891/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dataset 1.jpg" alt="Dataset 1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Elsewhere in the workbook, I have cells with formulas that refer to the SAS dataset via a table reference. For example, the formula reads:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=SUMIFS(RUS20_SOLAR[LFS20_SolarOutput_kW],RUS20_SOLAR[Cooperative],Input!$B$1,RUS20_SOLAR[year],'Exhibit 15'!$A10,RUS20_SOLAR[month],'Exhibit 15'!B$7)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where&amp;nbsp;&lt;EM&gt;RUS20_SOLAR&amp;nbsp;&lt;/EM&gt;is the name of the table in Excel and is the SAS dataset pictured.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I seek to replace the SAS datasets with new SAS datasets (as an example, replace RUS20_SOLAR with a new dataset but having the same column structure) while maintaining the same formula reference. When I attempt to do this manually I try two options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I attempt to replace the &lt;EM&gt;RUS20_Solar&lt;/EM&gt; table with my intended dataset by placing it in the location of the&amp;nbsp;&lt;EM&gt;RUS20_Solar&lt;/EM&gt; table (see picture).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Overwrite1.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65135iCAC39CE6A68947C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Overwrite1.jpg" alt="Overwrite1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, after clicking OK, I am given an error, "The specified output location already contains content. Please select a different location."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second option is I go to Manage Content and delete the table.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Delete1.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65136i2390FBCFB71DBF0E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Delete1.jpg" alt="Delete1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As soon as it is deleted, the formula becomes:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=SUMIFS(#REF!,#REF!,Input!$B$1,#REF!,'Exhibit 15'!$A10,#REF!,'Exhibit 15'!B$7)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;indicating the references to the&amp;nbsp;&lt;EM&gt;RUS20_Solar&lt;/EM&gt; table have been lost.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a workaround to this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if I can clarify. I appreciate any feedback and assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 15:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Excel-2016-SAS-Add-In-Replacing-SAS-Dataset-without-Losing/m-p/777017#M31435</guid>
      <dc:creator>sasforumuser</dc:creator>
      <dc:date>2021-10-28T15:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Excel 2016 SAS Add-In: Replacing SAS Dataset without Losing Formula Reference to Dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Excel-2016-SAS-Add-In-Replacing-SAS-Dataset-without-Losing/m-p/777320#M31459</link>
      <description>&lt;P&gt;This is a tricky situation based on the way that the add-in handles data.&amp;nbsp; The add-in doesn't want to insert data over another dataset since it can't have different tables pointing to the same cells.&amp;nbsp; If you refreshed one of them, they would be writing over each other and the worksheet would turn into a mess.&amp;nbsp; Likewise, if you try to clear out the previous table and insert the new one, Excel has lost its reference since it is specifically pointing to a location within the table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are 2 suggestions:&lt;/P&gt;
&lt;P&gt;1. We have an option for whether or not the data is opened into an Excel table or not:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TimBeese_0-1635518583139.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65225iED721B7797707489/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TimBeese_0-1635518583139.png" alt="TimBeese_0-1635518583139.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If you turn this option off, then when your data is inserted into the worksheet it will simply be in cells.&amp;nbsp; Now, you would lose the Excel functionality of the table object.&amp;nbsp; But, if you then add formulas that point to cell ranges, those are no longer linked to a table.&amp;nbsp; That way, if you remove the older table from the worksheet and replace it with a new one, the formulas will still be valid.&lt;/P&gt;
&lt;P&gt;2. You could write a stored process that would essentially copy the data from the data source you want to see into a new data source that would be inserted into the document.&amp;nbsp; When you want to change the data source, you could run the stored process, and then simply refresh the data to account for the new table.&amp;nbsp; Here is a step by step description to make this more clear:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Write a stored process that simply does something like:&amp;nbsp;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data SASDATA.FOREXCEL;
	set &amp;amp;dataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;This could be a prompted stored process, where the user will be prompted for the &amp;amp;dataset macro when it runs.&amp;nbsp; You could run this once so that your FOREXCEL data source is populated with the first table you want to use.&lt;/LI&gt;
&lt;LI&gt;The time comes where you want to replace the data in FOREXCEL with another table.&amp;nbsp; Simply run the stored process and it will prompt you for the data source.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TimBeese_1-1635519245966.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65226i0021D5922A58D209/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TimBeese_1-1635519245966.png" alt="TimBeese_1-1635519245966.png" /&gt;&lt;/span&gt;
&lt;P&gt;Provide the new data source, and it will overwrite your FORDATA table with the new one.&amp;nbsp; Now you can simply refresh the data table that you inserted into Excel, and it will update in place with the new columns/values.&amp;nbsp; You can even continue to use a table for it since you're never removing the table from the worksheet.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully one of these suggestions will work for you, or lead you to another possible solution.&amp;nbsp; Feel free to reach back out if you have questions on implementing these.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tim Beese&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 14:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Excel-2016-SAS-Add-In-Replacing-SAS-Dataset-without-Losing/m-p/777320#M31459</guid>
      <dc:creator>TimBeese</dc:creator>
      <dc:date>2021-10-29T14:59:56Z</dc:date>
    </item>
  </channel>
</rss>

