Program Path and Filename when in SAS

Reply
N/A
Posts: 1

Program Path and Filename when in SAS

Hi all

I hope somebody can help me.

Is there a way to obtain the current SAS program path and filename from within a SAS session. When batch submitting, this is stored in the SYSIN option, but I was hoping there is a way to find this when in SAS itself (that is, not batch submitting a program.)

Thanks.
SAS Employee
Posts: 27

Re: Program Path and Filename when in SAS

In SAS 9, there is a new environment variable for the Enhanced Editor named SAS_EXECFILENAME, then you can retrieve the name of the current program by issuing this statement:

%put The current program is %sysget(SAS_EXECFILENAME);

There is also an environment variable for the Enhanced Editor called SAS_EXECFILEPATH that contains the full path of the submitted program or catalog entry. The full path includes the folder and the filename.

%put The current path is %sysget(SAS_EXECFILEPATH);
Contributor
Posts: 49

Re: Program Path and Filename when in SAS

Dave,

It's good that SAS can finally pick-up the program it's executing at run-time interactively.

The problem is, these environment variables don't exist when the program is being batch-submitted.

Just a note to anyone using these environment variables that you need to be careful which SAS environment you're using them in.

You can check whether the program is being executed interactively (checking whether SYSPROCESSNAME = DMS PROCESS) or in batch mode.

Cheers,
Lawrence
Ask a Question
Discussion stats
  • 2 replies
  • 389 views
  • 0 likes
  • 3 in conversation