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

Like making a LIBNAME with PCFILES for directory whose name contain a space ?

Ex : TB_Rep PCFILES PATH="C:\T EMP\Toto.mdb" SERVER = %sysget(computername) ;

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You can use the TYPE= option to force it to treat the file as either Excel or Access file.

TYPE= EXCEL | ACCESS

specifies the file type in the PATH= statement.

Note:Use TYPE= if the file identified in the PATH= statement does not have an .xls or .mdb file extension.

View solution in original post

8 REPLIES 8
Peter_C
Rhodochrosite | Level 12

can you please clarify the context of that syntax?

Ambulance
Calcite | Level 5

Using SAS 9.3 64-bit to access the 32-bit MS Office files

But folder name contains a space and the line of code does not work with file whose name contains a space.

43802 - Installing SAS® 9.3 PC Files Server and using it to convert 32-bit Microsoft Office files to...http://support.sas.com/kb/43/802.html

Tom
Super User Tom
Super User

In WIndows if you want to reference a path with an embedded space you need to enclose it in quotes.

Since the SAS syntax requires quotes also the internal quotes need to be doubled.

LIBNAME TB_Rep PCFILES PATH="""C:\T EMP\Toto.mdb"""

SERVER = %sysget(computername)

;

You can use the QUOTE() function to make the necessary conversion for you.

LIBNAME TB_Rep PCFILES PATH=%sysfunc(quote("C:\T EMP\Toto.mdb"))

  SERVER = %sysget(computername)

;


Ambulance
Calcite | Level 5

I tried your thing and I received this error mesage :

647  LIBNAME TB_Rep PCFILES PATH= %sysfunc(quote("C:\T EMP\Toto.mdb"))
648    SERVER = %sysget(computername);

ERROR: Unable to determine file type from PATH= option.

ERROR: Error in the LIBNAME statement

Ambulance
Calcite | Level 5

I found the solution :

TB_Rep PCFILES PATH=%sysfunc(quote(C:\T EMP\Toto.mdb)) SERVER = %sysget(computername)



Tom
Super User Tom
Super User

So that is the same code that you started with.  Check to make sure that you have not entered your code into something like Microsoft Office.  That program has an extremely nasty habit of changing quotes into strange ASCII codes so that they look "pretty".

Tom
Super User Tom
Super User

You can use the TYPE= option to force it to treat the file as either Excel or Access file.

TYPE= EXCEL | ACCESS

specifies the file type in the PATH= statement.

Note:Use TYPE= if the file identified in the PATH= statement does not have an .xls or .mdb file extension.

Ambulance
Calcite | Level 5

Perfect,it works great with option :

TYPE= EXCEL | ACCESS and  %sysfunc(quote())

Tank you Tom

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 6567 views
  • 6 likes
  • 3 in conversation