How can I get the path of a script's own location (where the .sas file is saved), and assign that path to a variable?
Python equivalent would be:
import os
path = os.path.dirname(__file__)
I'm using EGuide on SAS 9.04
With EG, "path" can mean a lot of things:
Meaning:
I create a script, "example.sas"
I open that script in EGuide
I run the script, and in that script, the path where "example.sas" is assigned to a variable
Check this list of special macro variables in SAS Enterprise Guide. Check the SAS Enterprise Guide online help for the latest - captured here for v8.3:
Macro Variable |
Description |
---|---|
_CLIENTAPP |
Name of the client application |
_CLIENTMACHINE |
Client machine node name |
_CLIENTPROCESSFLOWNAME |
Name of the process flow |
_CLIENTPROJECTNAME |
File name for the project |
_CLIENTPROJECTPATH |
Full path and file name for the project |
_CLIENTTASKFILTER |
Filter that is defined for the task. You can use this macro variable in the titles and footnotes of the task so that the filter information is displayed in the title or footnote of your results. |
_CLIENTTASKLABEL |
Label for the current task. This is the text label that is displayed in the Project pane and the process flow. |
_CLIENTUSERID |
User ID of the client user |
_CLIENTUSERNAME |
Full user name, if that information is available |
_CLIENTVERSION |
Application version, including build number |
_SASHOSTNAME |
Server node name (IP address, DNS name, or DCOM name) |
_SASPROGRAMFILE |
Full path and file name of the SAS program that is currently being run. This macro variable is available only for SAS program files that are saved on the same server on which your SAS Enterprise Guide code is being run. |
_SASSERVERNAME |
Name of the logical server |
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.