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

Hello, I'm getting this error

ERROR: The PCFILES engine cannot be found.

ERROR: Error in the LIBNAME statement.

I'm trying to run this code:

libname custfm pcfiles path="&path/custfm.xls";

proc contents data=custfm._all_;

run;

data work.males;

run;

proc print data=work.males label;

run;

libname custfm clear;

Any thoughts as to what is wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
naveen_srini
Quartz | Level 8

did the libname get successfully assigned?

if yes, do a test using

proc contents data=custfm._all_;/* this will list you the datasets in the excel that you are reading */

run; 

If there aint any, well, you would have to know where your xls file is placed, i mean the exact location, find that, get it's path and replace exactly in the syntax and do again.

Alternatively, import the xls file to your SAS environment using the import wizard or proc import and get started with your SAS stuff. If this fails too, store the file as csv file and read with infile and input statements. Have fun!!!

View solution in original post

15 REPLIES 15
naveen_srini
Quartz | Level 8

I don't think you need to specify pcfiles engine and path= coz &path will just resolve to the defined path of macro by the macro processor by substituting it's value from the global symbol table and places it back into the input stack.

libname custfm "&path\custfm.xls"; *this should work getting your libname assigned.

Reeza
Super User

Are you in SAS University Edition?

flachboard
Fluorite | Level 6

No, I'm not in the SAS University Edition.

Reeza
Super User

Is PCFILES Server installed?

Do you need to use PCFILES at all?  It's used when you have SAS 64 bit and Excel 32 Bit.

What version of SAS do you have and what bitness? Also what version of Excel and bitness?

flachboard
Fluorite | Level 6


Naveen, I got this error when running what you advised:

 

WARNING: Apparent symbolic reference PATH not resolved.

ERROR: Connect: 'C:\Users\cflach\Documents\&path\custfm.xls' is not a valid path. Make sure

that the path name is spelled correctly and that you are connected to the server on

which the file resides.

ERROR: Error in the LIBNAME statement.

naveen_srini
Quartz | Level 8

Hi, &path will hold the value of the path. So if you are specifying the full path name, don't use macro &path

libname libref "your path"; *this is the syntax;

try this:  libname custfm 'C:\Users\cflach\Documents\custfm.xls' ; * assuming this is where your xls file is located;

flachboard
Fluorite | Level 6

Reeza,

How do I know if PCFILES server is installed?

Where do I find the bitness for SAS and Excel?

Thanks!!

Reeza
Super User

I would first try suggestion of hard coding the path, except with the EXCEL specified. Remember for macro variables to resolve you need to use double not single quotes.

libname custfm excel 'C:\Users\cflach\Documents\custfm.xls' ;


For PC File Server if you're on Windows desktop go to Programs>SAS>PC FILE SERVER should be in the list of applications.


For bitness of SAS, in SAS go to HELP>About SAS and see what is under Software Information.




ballardw
Super User

When referencing a macro variable and other literal text you need a . after the macro variable to indicate the end of the variable and that the remainder text is appended. &path/custfm.xls is going to look for a macro variable with /custfm as part of the name, which isn't a legal name and won't exist. Use &path./custfm.xls or &path.\custfm.xls depending on Operating System.

flachboard
Fluorite | Level 6

Thank you, Naveen.

I think I'm getting closer. I did get this warning though with nothing in the output:

 

WARNING: No matching members in directory.

naveen_srini
Quartz | Level 8

did the libname get successfully assigned?

if yes, do a test using

proc contents data=custfm._all_;/* this will list you the datasets in the excel that you are reading */

run; 

If there aint any, well, you would have to know where your xls file is placed, i mean the exact location, find that, get it's path and replace exactly in the syntax and do again.

Alternatively, import the xls file to your SAS environment using the import wizard or proc import and get started with your SAS stuff. If this fails too, store the file as csv file and read with infile and input statements. Have fun!!!

flachboard
Fluorite | Level 6

I think that worked. Sorry, I'm super new to SAS. Thank you so much!!

Reeza
Super User

Please mark question answered, I believe it goes

flachboard
Fluorite | Level 6

I'm sorry, this is my first time. How do I mark a question answered?

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
  • 15 replies
  • 2220 views
  • 3 likes
  • 4 in conversation