BookmarkSubscribeRSS Feed
siliconcreature
Calcite | Level 5
Hi there,

can you make this code work?

%let dir = "C:\";
libname c &dir;
7 REPLIES 7
siliconcreature
Calcite | Level 5
I mean this works under sas/windows, but not working with sas UNIX
RickM
Fluorite | Level 6
I haven't used UNIX in years (and never for SAS) but I thought UNIX uses the forward slash '/' for pathnames while the default in windows is the backslash( though it will accept the forward slash as valid) so try switching it in your program.
DBailey
Lapis Lazuli | Level 10
Are you perhaps trying to get your unix server based sas to see a directory on your local windows machine? I don't think that will work unless the sas server can "see" your local machine. There are some technologies that can let that happen, but the path would not be "c:\", it would be however your local drive was mounted to the unix server.
Ksharp
Super User
How about:
[pre]
%let dir = C:\;
libname c "&dir";

[/pre]


Ksharp
Ksharp
Super User
How about:
[pre]
%let dir = C:\;
libname c "&dir";

[/pre]


Ksharp
siliconcreature
Calcite | Level 5
your way is working, thank you.
PatrickG
SAS Employee
Yeah, don't use the double quotes. With the double quotes around it, the %let stores them (along with the good stuff inside) in the symbol table...

15 %let dir = "C:\";
16 %put &dir;
"C:\"

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 7 replies
  • 11404 views
  • 0 likes
  • 5 in conversation