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:\"

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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