Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

obtaining filepath 2

Status
Not open for further replies.

bryanbayfield

Technical User
Aug 10, 2001
345
EU
Hi:

I need to obtain a string representing the "long" filename of a program, and the code actually needs to be written inside that program.

So, if the filename of the program is C:/Windows/Desktop/blah.sas I need some code I can put within that program that returns "C:/Windows/Desktop/blah.sas" to a macro variable which I can then use in a call to another macro.

Anyone got any ideas on this?

I have tried messing around with X statements etc, to no avail.

Thanks.

bryan.

 
Well, I had 2 ideas, but neither has led me anywhere. My first idea was system generated macro variables, but none of these contain the currently running program.
Code:
proc sql;
  create table test as
  select *
  from dictionary.macros
  ;
quit;
My second idea was the system options, but that drew a blank too.
Code:
proc options;
run;

How are you calling the SAS program? Is it from a script (in batch mode) or are you opening it in SAS and running manually? If it's from a script you could pass the information from the script using SYSPARM. Otherwise, I'm out of ideas I'm afraid.

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
It's run in interactive mode, rather than from a shell.

Oh well, not to worry, thanks for trying.

You'd think they'd be some way, somehow, but alas not.

 
You can try the following:
ex
Code:
%Let FName = %SysGet( SAS_EXECFILEPATH ) ;

if you place this at the top of the program you will have a macro variable with the current filepath that is executed.

Hope that this helps you.

I am not sure if you use %INCLUDE statement that this trick works the way I just described, but you can try.

Klaz
 
Nice one Klaz!
It's always nice to learn something new. :)

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Excellent post, unfortunately my company is still using version 8.02, and it seems this only works in version 9?

I shall give you a star anyway, because I will file that one away for future knowledge!

Thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top