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.
You probably used the wrong character. Copy and past the path name from the explorer.
Note that Tést is not a French word.
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.
Type
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?
Directory exists, code runs on the same local machine.
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.
Thanks.
When I add "C:\" to the libname statement in the catt function:
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.
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.
Thanks. It was not my idea to name folders with such symbols, I just have to work with this case.
> 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.
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.
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!
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.