<?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 InsertDataFromLibrary works for some dataset but not for others in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593557#M2430</link>
    <description>&lt;P&gt;I am trying to get SAS data into my Excel spreadsheet and my below code can get the data from SASHelp library but not from WORK library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim sas As SASExcelAddIn
Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
sas.InsertDataFromLibrary "SASApp", "SASHelp", "CLASS", Sheet1.Range("A1")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But after copying the CLASS data to WORK library in SAS EG&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc copy in=sashelp out=home;
select class;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And changing the VBA code in my Excel to&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sas.InsertDataFromLibrary "SASApp", "WORK", "CLASS", Sheet1.Range("A1")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It gives me the below error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas error.png" style="width: 367px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32916i6438AD63E2047CA5/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas error.png" alt="sas error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone encounter the same issue and how did you resolve this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2019 21:40:50 GMT</pubDate>
    <dc:creator>thomas111</dc:creator>
    <dc:date>2019-10-02T21:40:50Z</dc:date>
    <item>
      <title>InsertDataFromLibrary works for some dataset but not for others</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593557#M2430</link>
      <description>&lt;P&gt;I am trying to get SAS data into my Excel spreadsheet and my below code can get the data from SASHelp library but not from WORK library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim sas As SASExcelAddIn
Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
sas.InsertDataFromLibrary "SASApp", "SASHelp", "CLASS", Sheet1.Range("A1")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But after copying the CLASS data to WORK library in SAS EG&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc copy in=sashelp out=home;
select class;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And changing the VBA code in my Excel to&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sas.InsertDataFromLibrary "SASApp", "WORK", "CLASS", Sheet1.Range("A1")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It gives me the below error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas error.png" style="width: 367px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32916i6438AD63E2047CA5/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas error.png" alt="sas error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone encounter the same issue and how did you resolve this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 21:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593557#M2430</guid>
      <dc:creator>thomas111</dc:creator>
      <dc:date>2019-10-02T21:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: InsertDataFromLibrary works for some dataset but not for others</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593561#M2431</link>
      <description>&lt;P&gt;Try copying to WORK rather than HOME.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 22:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593561#M2431</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-10-02T22:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: InsertDataFromLibrary works for some dataset but not for others</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593565#M2432</link>
      <description>Sorry, when I actually tried I had WORK library in PROC COPY statement. I can also see the CLASS dataset added into the WORK library.</description>
      <pubDate>Wed, 02 Oct 2019 22:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593565#M2432</guid>
      <dc:creator>thomas111</dc:creator>
      <dc:date>2019-10-02T22:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: InsertDataFromLibrary works for some dataset but not for others</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593744#M2433</link>
      <description>I can use the _PRODSAVAIL dataset in the WORK library and it works fine but not any other dataset in the WORK library.</description>
      <pubDate>Thu, 03 Oct 2019 14:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593744#M2433</guid>
      <dc:creator>thomas111</dc:creator>
      <dc:date>2019-10-03T14:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: InsertDataFromLibrary works for some dataset but not for others</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593761#M2434</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/293450"&gt;@thomas111&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The WORK library in EG and the WORK library in the SAS Add-in are not the same libraries. Enterprise Guide instantiates it's own workspace server session with a unique WORK library for that session of EG. The SAS Add-in does the same. They do not share a WORK library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Excel run the following code using SAS Programs to create the CLASS data set in the WORK library in the current workspace server session:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data class;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then run the following VBA in the same session of Excel:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sub InsertDataView()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Dim sas As SASExcelAddIn&lt;BR /&gt;&amp;nbsp; Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Dim data As SASDataView&lt;BR /&gt;&amp;nbsp; Set data = sas.InsertDataFromLibrary("SASApp", "WORK", "CLASS", Sheet1.Range("A5"), 10, False, "Sex='F'", "Age DESC", True)&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should see the results below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-10-03_10-58-09.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32928i7F01F63D8B9A2BAC/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-10-03_10-58-09.jpg" alt="2019-10-03_10-58-09.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 15:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593761#M2434</guid>
      <dc:creator>fifthand57th</dc:creator>
      <dc:date>2019-10-03T15:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: InsertDataFromLibrary works for some dataset but not for others</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593778#M2435</link>
      <description>&lt;P&gt;Thanks. That makes sense why it didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your help&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 15:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/InsertDataFromLibrary-works-for-some-dataset-but-not-for-others/m-p/593778#M2435</guid>
      <dc:creator>thomas111</dc:creator>
      <dc:date>2019-10-03T15:29:34Z</dc:date>
    </item>
  </channel>
</rss>

