DATA Step, Macro, Functions and more

PCFILES LIBNAME withe space in name

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

PCFILES LIBNAME withe space in name

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) ;


Accepted Solutions
Solution
‎07-04-2013 04:05 PM
Super User
Super User
Posts: 7,080

Re: PCFILES LIBNAME withe space in name

Posted in reply to Ambulance

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


All Replies
Valued Guide
Posts: 2,177

Re: PCFILES LIBNAME withe space in name

Posted in reply to Ambulance

can you please clarify the context of that syntax?

Occasional Contributor
Posts: 5

Re: PCFILES LIBNAME withe space in name

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

Super User
Super User
Posts: 7,080

Re: PCFILES LIBNAME withe space in name

Posted in reply to Ambulance

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)

;


Occasional Contributor
Posts: 5

Re: PCFILES LIBNAME withe space in name

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

Occasional Contributor
Posts: 5

Re: PCFILES LIBNAME withe space in name

Posted in reply to Ambulance

I found the solution :

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



Super User
Super User
Posts: 7,080

Re: PCFILES LIBNAME withe space in name

Posted in reply to Ambulance

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".

Solution
‎07-04-2013 04:05 PM
Super User
Super User
Posts: 7,080

Re: PCFILES LIBNAME withe space in name

Posted in reply to Ambulance

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.

Occasional Contributor
Posts: 5

Re: PCFILES LIBNAME withe space in name

Perfect,it works great with option :

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

Tank you Tom

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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