BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
shashank1691
Calcite | Level 5

Sorry for the confusion..

 

I am unable to import any file...

 

So basically when we import any file (.xlsx/xls, .csv) or any format..

I went like,   File -> Import Data -> Select format -> Browse file -> (When I select Excel)  ------> Connection failed (Check log for details)

 

Importing .xlsImporting .xls

 

Log details:

 

ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.
ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.

 

 

When I import .csv file  File -> Import Data -> Select format -> Browse file -> (When I select .csv) ------> 

 

PROC IMPORT OUT= WORK.FAMILYHD 
            DATAFILE= "C:\Users\Shashank\Desktop\DEN SD & HD plan list (
1).csv" 
            DBMS=CSV REPLACE;
     GETNAMES=YES;
     DATAROW=2; 
RUN;

When I run this code this is the log detail I get

 

 

NOTE: The LocalTime has been updated.
NOTE: This is likely due to a Daylight Savings Time or Timezone change.
NOTE:
NOTE: The LocalTime has been updated.
NOTE: This is likely due to a Daylight Savings Time or Timezone change.
NOTE:
NOTE: Import Cancelled.
1    PROC IMPORT OUT= WORK.FAMILYHD
2                DATAFILE= "C:\Users\Shashank\Desktop\DEN SD & HD plan list (
3    1).csv"
4                DBMS=CSV REPLACE;
5         GETNAMES=YES;
6         DATAROW=2;
7    RUN;

ERROR: File is in use, C:\Users\Shashank\Desktop\DEN SD & HD plan list (1).csv.
ERROR: Import unsuccessful.  See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.23 seconds
      cpu time            0.04 seconds

 

 

 

Kindly suggest..

 

Kurt_Bremser
Super User

So this has nothing to do with a LIBNAME statement.

 

Your first issue can have two reasons

  • SAS/ACCESS to PC Files is not installed or not licensed
  • Your MS Office has a d8fferent bitness (32/64) than your SAS.

For the second issue, make sure that Excel (or other software) is no longer keeping the csv file open.

shashank1691
Calcite | Level 5

Hello,

IT WORKED!!

 

Thank you so much. Like you told, my MS office was installed in 32 bits and after I changed it to 64 bit and closed all open windows, I was able to Import both CSV and Excel files.

 

Thanks a lot.

Kurt_Bremser
Super User

Note that you only need a 64-bit Office for .xls files. .xlsx has a newer engine in SAS that is completely platform- and bitness-independent.

And csv files don't need anything (read: SAS/ACCESS to PC Files) at all, you can read them with a data step out of the box.

ballardw
Super User

Please rerun your libname code. Then go to your log, copy the code and any messages and then paste the copied code into a code box opened on the forum with the {I} icon.

For example when I use a libname statement that references a location that does not exist I get this:

 

529  libname junk "Q:\somefolder";
ERROR: Create of library JUNK failed.
ERROR: Error in the LIBNAME statement.

In this case I know the issue is that I have no Drive letter Q and there is no folder. If you see a similar error of the Create library failed something related to the path listed is almost always the cause unless you are providing a lot of options such as needed to connect to a remote database system like SQL Server or Oracle.

 

Common issues: Spelling, extra or missing letters in folders in the path.

in Unix based systems the path spelling is also case sensitive. If a folder is named "Somefolder" and you use "somefolder" that is not valid spelling. Solution: correct spelling.

 

In many places you may actually be connecting to a server to run the code. That server is on a different machine and likely does not have access to the hard drive of your computer. If this is the case when you attempt to connect to C:\libsas\finaldata it would be looking on the Server hard drive and the path almost certainly does not exist. The solution here depends on set up which may mean moving your files to a specific location where the server can read the files or if using Enterprise Guide a task to upload the data to a server.

 

If using SAS University Edition then SAS runs in a Linux  "Virtual Machine" which you should have set up. It is only allowed to "see" folders in specific locations related to how the virtual machine was installed.

 

Any code that references the library LIBSAS will generate the error message if the library was not created. Which is why I ask to have you run just the Libname code and show the result.

SASJedi
SAS Super FREQ

Here are the most common reasons why SAS can't find the file or folder you are referencing:

1. A typo in the code. For example, I am running PC SAS. There are SAS data sets in the c:\testfile folder that I need. I submit this code:

LIBNAME T "C:\testfiles";

and the LOG says:

NOTE: Library T does not exist.

 

2. SAS doesn't have access to the file location you have specified. This usually happens when you're using client software, like Enterprise Guide or SAS Studio, to write and submit your SAS code, but SAS isn't installed on your computer - it's running on a server somewhere else. It gets tricky because it's essential to differentiate between what the client can see and what the SAS server can see because now they are installed on two different machines. So let's step through this, starting with SAS installed on your computer.
Windows Explorer (gear image) can see the files on the local hard drive. Because SAS is installed on the PC, if you expand Folders under the Local server in Enterprise Guide, you can see the same files there: 

SASJedi_0-1657121669969.png

 

If I have a network drive mapped, both Windows Explorer and the Enterprise Guide Server can see those files, too:

SASJedi_1-1657122016143.png


Now, when SAS is installed on a separate server (including SAS University Edition, where SAS is running on a virtual server), the SAS server can no longer "see" files on the PC hard drive. Windows and SAS no longer share the same "view". If you browse the SAS Server files in Enterprise Guide, you can see the view is different:

SASJedi_4-1657123254454.png

 

If the PC and SAS server both have access to the same network location, you can move files there in Windows and "see" them in SAS, but the PATH to those in Windows will be different than the path on the SAS server:

 

SASJedi_3-1657122825015.png

So, when SAS was installed on the PC, this LIBNAME would have worked:

libname t "s:\workshop";

And with SAS on the server, this LIBNAME would see the same data:

libname t "/mnt/share/workshop";

If you can't locate your network files in Enterprise Guide (or SAS Studio) by browsing in the Server -> Files folders, it might still be possible to access them from SAS, but you'll need to ask your SAS administrator how to specify the proper path.  

May the SAS be with you!

Mark

 

Check out my Jedi SAS Tricks for SAS Users

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 20 replies
  • 37923 views
  • 2 likes
  • 8 in conversation