BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Leo9
Quartz | Level 8

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 ? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

@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.

View solution in original post

7 REPLIES 7
SASKiwi
PROC Star

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. 

 

Kurt_Bremser
Super User

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.

Leo9
Quartz | Level 8

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

Tom
Super User Tom
Super User

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?

Leo9
Quartz | Level 8

Thank you. Actual dir name is  //space/project/abc123 

Tom
Super User Tom
Super User

@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.

Leo9
Quartz | Level 8

Thank you. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 7 replies
  • 579 views
  • 2 likes
  • 4 in conversation