Hi am trying to run this piece of code on using EG which runs SAS on Unix server;
%let rc=%sysfunc(filename(filrf,&dir));
%put &filrf ;
%let did=%sysfunc(dopen(&filrf));
For some reason the filrf is not resolving properly. I checked dir path many time and it is accurate.
I also changed "\" to "/" to consider unix path.
dir = c/temp/mydir/test
Macro variable FILRF is getting resolved to. "Macro variable FILRF resolves to #LN00019"
did is resolving to 0.
Can anyone help to suggest how to resolve this issue ?
@Leo9 wrote:
Thank you. Actual dir name is //space/project/abc123
You have an extra / there. The root node in the Unix filesystem is referenced with /. Then you only add more / when you have a directory name.
So let's build up your path in steps:
/ -> The top of the whole file system, called the root node.
/space -> Directory under the root node
/space/project -> Directory under the /space directory
/space/project/abc123 -> File (or directory, a directory is just a special type of file) in the /space/project directory.
And if by the // you meant the \\ symbol that DOS/WIndows uses in UNC (Universal Naming Convention ) to reference a shared network drive. So if you have a UNC like \\servername\sharename\path\filename that works on Windows and you want to access that file on Unix you have the Unix admins MOUNT the \\servername\sharename (or possibly just the \\servername\sharename\path) to some location in the Unix Filesystem. So they might make a directory named windows_shares under the root node and mount shares under there so that the path on unix might be /windows_shares/servername/sharename/path. Or perhaps they will make directory named projects somewhere and mount your project under that directory.
Where is this supposed to be pointing - dir = c/temp/mydir/test?
If it is to your own local PC drive that isn't possible from a Unix server as no folder share has been defined. Talk to your SAS administrator about setting up a folder share that can accessed from both Windows and the Unix SAS server. Most likely that will be on a file server, not your local PC drive.
I am confident that you will not find this path
c/temp/mydir/test
on a UNIX system.
If you try to do a directory listing of a Windows path on a UNIX system, this path needs to be made a network share and mounted on UNIX, where it will have a different name.
You are right. I was using that as an example. Main issue is that SAS is not able to resolve the filename.
Dir path is something like this : //space/project/abc123
Since
c/temp/mydir/test
does not start with the root node it will be considered a RELATIVE filename.
What is the current working directory? You can ask SAS to tell you using this code:
filename here '.';
%put Current Directory=%sysfunc(pathname(here)) ;
Is there really a subdirectory there named lowercase c?
Thank you. Actual dir name is //space/project/abc123
@Leo9 wrote:
Thank you. Actual dir name is //space/project/abc123
You have an extra / there. The root node in the Unix filesystem is referenced with /. Then you only add more / when you have a directory name.
So let's build up your path in steps:
/ -> The top of the whole file system, called the root node.
/space -> Directory under the root node
/space/project -> Directory under the /space directory
/space/project/abc123 -> File (or directory, a directory is just a special type of file) in the /space/project directory.
And if by the // you meant the \\ symbol that DOS/WIndows uses in UNC (Universal Naming Convention ) to reference a shared network drive. So if you have a UNC like \\servername\sharename\path\filename that works on Windows and you want to access that file on Unix you have the Unix admins MOUNT the \\servername\sharename (or possibly just the \\servername\sharename\path) to some location in the Unix Filesystem. So they might make a directory named windows_shares under the root node and mount shares under there so that the path on unix might be /windows_shares/servername/sharename/path. Or perhaps they will make directory named projects somewhere and mount your project under that directory.
Thank you.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.