<?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: LIBNAME error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282446#M269846</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;* Make a copy of the mdb just in case;
* I prefer the older "full" version of access because access meta data is available;
* you can always move the data to the newer version;

x "copy d:\mdb\db.mdb d:\mdb\want.mdb";

* prep SAS dataset for R;
data "d:/sd1/class.sas7bdat";
  set sashelp.class;
run;quit;

%utl_submit_r32(
library(RODBC);
library(haven);&lt;BR /&gt;class&amp;lt;-read_sas('d:/sd1/class.sas7bdat');
myDB &amp;lt;- odbcConnectAccess(""d:/mdb/want.mdb"",uid=""admin"",pwd="""");
sqlSave(myDB,class,rownames=FALSE);
);

libname mdb "d:\mdb\want.mdb";
proc contents data=mdb._all_;
;run;quit;
libname mdb clear;

he CONTENTS Procedure

         Directory

ibref         MDB
ngine         ACCESS
hysical Name  d:\mdb\want.mdb
ser           Admin


                 DBMS
         Member  Member
  Name   Type    Type

  class  DATA    TABLE


Data Set Name        MDB.class    Observations          .
Member Type          DATA         Variables             5
Engine               ACCESS       Indexes               0
Created              .            Observation Length    0
Last Modified        .            Deleted Observations  0
Protection                        Compressed            NO
Data Set Type                     Sorted                NO
Label
Data Representation  Default
Encoding             Default


         Alphabetic List of Variables and Attributes

#    Variable    Type    Len    Format    Informat    Label

3    AGE         Num       8                          AGE
4    HEIGHT      Num       8                          HEIGHT
1    NAME        Char    255    $255.     $255.       NAME
2    SEX         Char    255    $255.     $255.       SEX
5    WEIGHT      Num       8                          WEIGHT




&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Jul 2016 15:04:40 GMT</pubDate>
    <dc:creator>rogerjdeangelis</dc:creator>
    <dc:date>2016-07-06T15:04:40Z</dc:date>
    <item>
      <title>LIBNAME error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282394#M269843</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to export a SAS dataset to MS Access using the Libname statement. When I code this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#0000ff"&gt;libname&lt;/FONT&gt; &lt;FONT color="black"&gt;DatIn ACCESS PATH=&lt;/FONT&gt;&lt;FONT color="purple"&gt;"C:\Temp\ExpAcc.accdb"&lt;/FONT&gt;&lt;FONT color="black"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I get this error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="SAS Monospace" size="1"&gt;&lt;SPAN style="font-size: 8pt;"&gt;22&amp;nbsp;&amp;nbsp; libname DatIn ACCESS PATH="C:\Temp\ExpAcc.accdb";&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;FONT face="SAS Monospace" size="1"&gt;&lt;SPAN style="font-size: 8pt;"&gt;ERROR: Connect: Class not registered&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;FONT face="SAS Monospace" size="1"&gt;&lt;SPAN style="font-size: 8pt;"&gt;ERROR: Error in the LIBNAME statement&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;According to page “The LIBNAME Statement for Access and Excel on Microsoft Windows” in the SAS/ACCESS help, this is one of two options for assigning a libref to an MS Access file.&amp;nbsp; The other option is&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;FONT color="blue" face="Courier New" size="2"&gt;&lt;SPAN style="font-size: 10pt;"&gt;libname &lt;FONT color="black"&gt;DatIn&lt;/FONT&gt; &lt;FONT color="purple"&gt;"C:\Temp\ExpAcc.accdb"&lt;/FONT&gt;&lt;FONT color="black"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;both of which produce the same error.&lt;/DIV&gt;&lt;DIV&gt;Thank you,&lt;/DIV&gt;&lt;DIV&gt;John&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Jul 2016 12:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282394#M269843</guid>
      <dc:creator>JohnSAScom</dc:creator>
      <dc:date>2016-07-06T12:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282395#M269844</link>
      <description>&lt;P&gt;Your SAS installation and you Microsoft Office installation are using different number of bits (32 vs 64). &amp;nbsp;Check with your system admins to see if you can change one or the other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 12:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282395#M269844</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-07-06T12:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282402#M269845</link>
      <description>&lt;P&gt;Thank you Tom!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 12:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282402#M269845</guid>
      <dc:creator>JohnSAScom</dc:creator>
      <dc:date>2016-07-06T12:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282446#M269846</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;* Make a copy of the mdb just in case;
* I prefer the older "full" version of access because access meta data is available;
* you can always move the data to the newer version;

x "copy d:\mdb\db.mdb d:\mdb\want.mdb";

* prep SAS dataset for R;
data "d:/sd1/class.sas7bdat";
  set sashelp.class;
run;quit;

%utl_submit_r32(
library(RODBC);
library(haven);&lt;BR /&gt;class&amp;lt;-read_sas('d:/sd1/class.sas7bdat');
myDB &amp;lt;- odbcConnectAccess(""d:/mdb/want.mdb"",uid=""admin"",pwd="""");
sqlSave(myDB,class,rownames=FALSE);
);

libname mdb "d:\mdb\want.mdb";
proc contents data=mdb._all_;
;run;quit;
libname mdb clear;

he CONTENTS Procedure

         Directory

ibref         MDB
ngine         ACCESS
hysical Name  d:\mdb\want.mdb
ser           Admin


                 DBMS
         Member  Member
  Name   Type    Type

  class  DATA    TABLE


Data Set Name        MDB.class    Observations          .
Member Type          DATA         Variables             5
Engine               ACCESS       Indexes               0
Created              .            Observation Length    0
Last Modified        .            Deleted Observations  0
Protection                        Compressed            NO
Data Set Type                     Sorted                NO
Label
Data Representation  Default
Encoding             Default


         Alphabetic List of Variables and Attributes

#    Variable    Type    Len    Format    Informat    Label

3    AGE         Num       8                          AGE
4    HEIGHT      Num       8                          HEIGHT
1    NAME        Char    255    $255.     $255.       NAME
2    SEX         Char    255    $255.     $255.       SEX
5    WEIGHT      Num       8                          WEIGHT




&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jul 2016 15:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282446#M269846</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-07-06T15:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282667#M269847</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, changing either installation is not an option. As it turns out, I should not have been&amp;nbsp;attempting to use the LIBNAME statement at all.&amp;nbsp; The context is that I was trying to export a SAS dataset to MS Access, and I thought I could use the LIBNAME to do so, however, in my case, there is a good probability that the MS Access database I'm trying to create already exists, so the LIBNAME statement would not work. I needed to use PROC EXPORT so that I could specify the REPLACE option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My solution is like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = SAS_DS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms = accesscs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outtable = EXPACCESS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; database = "c:\dir\NewDB.accdb";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For me, the key was the value of the DBMS= option. &amp;nbsp;When I read the SAS/ACCESS help page entitled&lt;/P&gt;&lt;P&gt;&lt;EM&gt;File Format-Specific Reference for the IMPORT and EXPORT Procedures&lt;/EM&gt;, it said&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"For an existing .mdb you can specify DBMS=ACCESSCS when using the client/server model and SAS identifies the version of Access for you."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mistakenly interpreted this to imply that I could not use it with .accdb files, but you can, as explained in the SAS/ACCESS help page entitled "PROC EXPORT".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 12:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282667#M269847</guid>
      <dc:creator>JohnSAScom</dc:creator>
      <dc:date>2016-07-07T12:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282669#M269848</link>
      <description>&lt;P&gt;Hi Roger,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see my reply to Tom. In my case, the MS Access database I'm trying to create probably already exists, so I would not be able to use the LIBNAME statement. Your solution looks interesting, but, in my case, if I wanted to connect to an existing MS Access database using the LIBNAME statement,&amp;nbsp;I think an easier solution would be to use the SAS PC Files Server in the libname:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname mylibref pcfiles path="C:\dir\MyAccessDB.accdb";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 12:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error/m-p/282669#M269848</guid>
      <dc:creator>JohnSAScom</dc:creator>
      <dc:date>2016-07-07T12:44:52Z</dc:date>
    </item>
  </channel>
</rss>

