BookmarkSubscribeRSS Feed
pavelr
Obsidian | Level 7

How do I deal with paths that have French symbols?

 

When I try to run:

libname test 'C:\Tést';

SAS says that this library does not exist (though this folder exists).

 

When I try to use FILENAME function:

rc=filename('fname', 'C:\Tést\test.sas7bdat');

it does not work either.

11 REPLIES 11
ChrisNZ
Tourmaline | Level 20

You probably used the wrong character. Copy and past the path name from the explorer.

Note that  Tést  is not a French word.

pavelr
Obsidian | Level 7

This a copy-paste:

 

libname tes 'C:\Tést';

 

Maybe Tést is not a French word, but é is a French symbol. I need to work with folders with such symbols.

ChrisNZ
Tourmaline | Level 20

Type 

ChrisNZ_1-1626772359429.png

in a command prompt window to show us that the path exists.

 

If SAS says it doesn't exist, then it doesn't (or the userid running SAS doesn't have the authorisation to access).

 

Another possibility is that the path is local and the code runs on a server. Did you make this confusion?

 

 

pavelr
Obsidian | Level 7

Directory exists, code runs on the same local machine.

pavelr_0-1626773294311.png

 

pavelr_1-1626773327313.png

 

ChrisNZ
Tourmaline | Level 20

Please try this:

filename DIR pipe 'dir c:\T* /b';
data _null_;
  infile DIR;
  input;
  if prxmatch('/T.*st',_INFILE_);
  putlog _INFILE_;
  call execute(catt('libname TEST "',_INFILE_,'";'));
run;

and show us the log.

 

pavelr
Obsidian | Level 7

Thanks.

pavelr_0-1626783409259.png

When I add "C:\" to the libname statement in the catt function:

pavelr_1-1626783516465.png

ChrisNZ
Tourmaline | Level 20

Ah yes of course, thanks for adding C:\  .

 

Why is there no accent there?

Ask the people who maintain this folder what this is all about.

 

This e is not what is seems. Something is very wrong with the way this path was typed. 

You should definitely ask that the folder name be retyped (renamed).

 

As additional information, you could replace the putlog with

putlog _INFILE_ $hex64.;

but really, just cut this nonsense lose.

Kurt_Bremser
Super User

It may be that one part of your software (SAS or Windows) works with codepage Windows-1252, while the other (Windows or SAS) is set to UTF encoding. The character will be encoded differently in both settings.

 

Bottom line: it is NEVER a good idea to have anything but the 26 letters (upper- and lowercase), digits, and the underline symbol in directory or file names. NEVER. Rectify that, and you'll have a much brighter future.

pavelr
Obsidian | Level 7

Thanks. It was not my idea to name folders with such symbols, I just have to work with this case.

ChrisNZ
Tourmaline | Level 20

> It was not my idea to name folders with such symbols, I just have to work with this case.

That's bad practice as you can see now.

A likely scenario is that the folder exists in Linux and uses UTF8 encoding. You see it in windows with a translated name using wlatin encoding.

You take this Windows name and try to use it on the server and of course it fails.

SAS sometimes does the translation since you have a Windows client and a Linux server, but it depends on the environment you use.

 

 

pavelr
Obsidian | Level 7

I agree that it is not a good practice to use such symbols as well as spaces, dashes, etc. for folder and file names. Thank you for taking your time to look into it.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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