<?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 Re: Connecting EXCEL VBA with SAS in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232715#M2725</link>
    <description>&lt;P&gt;My intension is to build a connection string with SAS and get the data in the spreadsheet. Later on I am using those data to make some formation. I am sure, we can do this. but i am facing some difficulties. So some one must have for sure tried this out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2015 12:15:12 GMT</pubDate>
    <dc:creator>vps</dc:creator>
    <dc:date>2015-11-02T12:15:12Z</dc:date>
    <item>
      <title>Connecting EXCEL VBA with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232713#M2723</link>
      <description>&lt;P&gt;Hi -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to connect SAS from VBA and fetch the data to excel spread sheet. Below is the code what I am trying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Public Sub GetData()&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; &lt;BR /&gt; Dim obConnection As ADODB.Connection&lt;BR /&gt; Dim obRecordset As ADODB.Recordset&lt;BR /&gt; Dim i As Integer&lt;BR /&gt; &lt;BR /&gt; Set obConnection = New ADODB.Connection&lt;BR /&gt; obConnection.Provider = "sas.LocalProvider.1"&lt;BR /&gt; obConnection.Properties("Data Source") = "sas.abc.abc.com:1234"&lt;BR /&gt; obConnection.ConnectionString = "Provider=SAS.IOMProvider; Data Source=iom-bridge://&lt;SPAN&gt;sas.&lt;/SPAN&gt;&lt;SPAN&gt;abc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;abc&lt;/SPAN&gt;&lt;SPAN&gt;.com:&lt;/SPAN&gt;&lt;SPAN&gt;1234&lt;/SPAN&gt;; User ID=abcd;Password=1234"&lt;BR /&gt; Set obRecordset = New ADODB.Recordset&lt;BR /&gt; obRecordset.Open "proc sql; select *&amp;nbsp;from aa.getdata_dim; QUIt;",&amp;nbsp;obConnection, adOpenStatic, adLockPessimistic,&amp;nbsp;&lt;BR /&gt;End Sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When my code try to open the recordset. Code fails and&amp;nbsp;I am prompted with run time error as below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;---------------------------&lt;BR /&gt;Microsoft Visual Basic for Applications&lt;BR /&gt;---------------------------&lt;BR /&gt;Run-time error '3709':&lt;/P&gt;
&lt;P&gt;Application-defined or object-defined error&lt;BR /&gt;---------------------------&lt;BR /&gt;OK Help &lt;BR /&gt;---------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has any one achieved this, and help me out ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;VS&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 11:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232713#M2723</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-02T11:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting EXCEL VBA with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232714#M2724</link>
      <description>&lt;P&gt;Yes, I don't think you can do it like that. &amp;nbsp;Datasets are not a database. &amp;nbsp;Also, you seem to be trying to use SAS commmands to select??&lt;/P&gt;
&lt;P&gt;What is wrong with just saving the data to CSV, then you can open the CSV file via VBA.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 12:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232714#M2724</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-02T12:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting EXCEL VBA with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232715#M2725</link>
      <description>&lt;P&gt;My intension is to build a connection string with SAS and get the data in the spreadsheet. Later on I am using those data to make some formation. I am sure, we can do this. but i am facing some difficulties. So some one must have for sure tried this out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 12:15:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232715#M2725</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-02T12:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting EXCEL VBA with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232722#M2726</link>
      <description>&lt;P&gt;Actually yes, a quick google search results in:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lexjansen.com/phuse/2005/as/as11.pdf" target="_blank"&gt;http://www.lexjansen.com/phuse/2005/as/as11.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/25447567/using-vba-to-get-data-from-sas-and-limit-the-data-set" target="_blank"&gt;http://stackoverflow.com/questions/25447567/using-vba-to-get-data-from-sas-and-limit-the-data-set&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However I would still question why you want to do this. &amp;nbsp;Just export the data from SAS to CSV, SAS is not a database, hence you wouldn't want to be querying it at regular intervals like you do with a database. &amp;nbsp;When you want to use the data, run an export. &amp;nbsp;Reasons this would be a better approach - formats would not be pushed out properly and you may want to process the data before export. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want access to data in the form of a database, use a database?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 12:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232722#M2726</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-02T12:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting EXCEL VBA with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232724#M2727</link>
      <description>Thanks for the LINK. I have already gone thru this reference and it didnt help me out. &lt;BR /&gt;Answering to your question. I am trying to automate something., which cannot be achieve by SAS to CSV.&lt;BR /&gt;&lt;BR /&gt;Do you have any idea what is diff between &lt;BR /&gt;obConnection.Properties("Data Source") = "C:\path\" &lt;BR /&gt;&lt;BR /&gt;and &lt;BR /&gt;&lt;BR /&gt;obConnection.Properties("Data Source") = "sas.abc.abc.com:1234"&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Nov 2015 13:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232724#M2727</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-02T13:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting EXCEL VBA with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232726#M2728</link>
      <description>&lt;P&gt;Well, I would still use one or the other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for that code, it looks like the first instance is referencing connection information as stored in a file on your local machine, whereas the second appears to be contacting a web address, however it looks like the web address you have given is just a dummy one to give an example, i.e. you would change to the URL where the connection is, and apparently a post number after the web address. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://msdn.microsoft.com/en-us/library/office/ff837414.aspx?f=255&amp;amp;MSPPError=-2147217396" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/office/ff837414.aspx?f=255&amp;amp;MSPPError=-2147217396&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be better off checking a ticket with the helpdesk, I don't know of anyone who tries to pull data out of a dataset with VBA, its always create an export file then import. &amp;nbsp;What is it you need to automate, there may be better options.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 13:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/232726#M2728</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-02T13:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting EXCEL VBA with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/713829#M14588</link>
      <description>&lt;P&gt;I think you need to add the Microsoft ActiveX Data Objects 2.8 Library to the References in VBA Project..&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 06:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Connecting-EXCEL-VBA-with-SAS/m-p/713829#M14588</guid>
      <dc:creator>antontansengco</dc:creator>
      <dc:date>2021-01-25T06:49:04Z</dc:date>
    </item>
  </channel>
</rss>

