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-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!

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
  • 8 replies
  • 5854 views
  • 6 likes
  • 3 in conversation