BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chris2377
Quartz | Level 8

Hi,

 

I'm trying to import the xlsm file using libname excel statement:

 

libname test excel "C:\...\test_file.xlsm";

The test file is very simple, it has 2 variables and 2 observations.

 

When I run the code, SAS creates the library test as expected, but I cannot open the dataset with data taht is inside. It says that the table does not exist or it cannot be displayed. Why?

1 ACCEPTED SOLUTION

Accepted Solutions
Vince_SAS
Rhodochrosite | Level 12

It appears that the PC Files Server isn't installed.  If it's installed then there should be an item under the SAS start menu named "PC File Server".

 

I don't think there is a bitness mismatch because the original post indicated that the library was assigned.

 

Save the attached "Book1.xlsm.txt" file on your system and then rename it to remove the .txt extension (forum software disallows XLSM files).  Modify the code below to specify the correct file path, and then run the code:

  

options validvarname=any validmemname=extend;

libname indata excel 'path-to-file\Book1.xlsm' access=read;

title 'EXCEL Engine';

proc contents data=indata._all_; run; quit;

proc print data=indata.'Sheet1$'n; run; quit;


libname indata xlsx 'path-to-file\Book1.xlsm' access=read;

title 'XLSX Engine';

proc contents data=indata._all_; run; quit;

proc print data=indata.Sheet1; run; quit;

 

 PROC CONTENTS reports these table names for the EXCEL engine:

 

INDATA.'Sheet1$'n
INDATA.'Sheet2$'n
INDATA.'Sheet3$'n

 

and these for the XLSX engine:

 

INDATA.SHEET1
INDATA.SHEET2
INDATA.SHEET3

 

You must use the names that the respective engine expects (case does not matter in this instance).

 

Does that help?

 

Vince DelGobbo

SAS R&D

View solution in original post

9 REPLIES 9
error_prone
Barite | Level 11
What is the name of the sheet?
chris2377
Quartz | Level 8

@error_prone Default name ("Sheet1"). I've tried to import other files where sheets are named differently. Every time, datasets appear in the library but I cannot open them

Vince_SAS
Rhodochrosite | Level 12

Try the PCFILES engine:

 

libname indata pcfiles path='C:\temp\myfile.xlsm' access=read;

options validvarname=any validmemname=extend;

proc contents data=indata._all_; run; quit;

 

Vince DelGobbo

SAS R&D

chris2377
Quartz | Level 8

@Vince_SAS

I 've tried. The result is: 

 

ERROR: Internal error: unable to communicate with PC Files Server process.
ERROR: Error in the LIBNAME statement

Vince_SAS
Rhodochrosite | Level 12

I should have asked earlier - What operating system is SAS running on, and what version of SAS are you using?

 

On UNIX systems the SAS PC Files Server needs to be started and running on a Windows machine.

 

Vince DelGobbo

SAS R&D

chris2377
Quartz | Level 8

@Vince_SAS

 

Sas 9.4 M3 + Windows 7 64 bit

error_prone
Barite | Level 11

Afaik you still need the PC Files service, assuming that MS Office is 32bit.

Vince_SAS
Rhodochrosite | Level 12

It appears that the PC Files Server isn't installed.  If it's installed then there should be an item under the SAS start menu named "PC File Server".

 

I don't think there is a bitness mismatch because the original post indicated that the library was assigned.

 

Save the attached "Book1.xlsm.txt" file on your system and then rename it to remove the .txt extension (forum software disallows XLSM files).  Modify the code below to specify the correct file path, and then run the code:

  

options validvarname=any validmemname=extend;

libname indata excel 'path-to-file\Book1.xlsm' access=read;

title 'EXCEL Engine';

proc contents data=indata._all_; run; quit;

proc print data=indata.'Sheet1$'n; run; quit;


libname indata xlsx 'path-to-file\Book1.xlsm' access=read;

title 'XLSX Engine';

proc contents data=indata._all_; run; quit;

proc print data=indata.Sheet1; run; quit;

 

 PROC CONTENTS reports these table names for the EXCEL engine:

 

INDATA.'Sheet1$'n
INDATA.'Sheet2$'n
INDATA.'Sheet3$'n

 

and these for the XLSX engine:

 

INDATA.SHEET1
INDATA.SHEET2
INDATA.SHEET3

 

You must use the names that the respective engine expects (case does not matter in this instance).

 

Does that help?

 

Vince DelGobbo

SAS R&D

chris2377
Quartz | Level 8
Thanks, it works now.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 9 replies
  • 8456 views
  • 0 likes
  • 3 in conversation