BookmarkSubscribeRSS Feed
sudharsanan
Calcite | Level 5

Hi,

Is there is any way to read directory path from the file reference?

for e.g. I had file references declared in one stage of a program as: filename fref <dir>;

In other place I want to get the directory path <dir> only by using fref.

Please let me know how this can be done.

your help is much appreciated.

-Sudharsanan

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

You want:

data _null_;

  put %sysfunc(pathname( **your file refence** ));

run;

So the %sysfunc(pathname()) will return the address.

Tom
Super User Tom
Super User

You seem to have mixed macro and data step logic there.

In a data step you can call the PATHNAME() function directly.

data _null_;

  path = pathname('sashelp');

  put path=;

run;

In macro code you can call the PATHNAME() function using %SYSFUNC().

%put path=%sysfunc(pathname(sashelp));

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
  • 2 replies
  • 371 views
  • 0 likes
  • 3 in conversation