- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
With EG, "path" can mean a lot of things:
- the path to the directory from which a project file was loaded
- the name and location of a node within a project file
- the path where a code node is stored externally (if the EG project has a link to it instead of an embedded program)
- the path of a file that was %INCLUDEd on the server.
- the path of the SAS executable
- the path of the EG executable on Windows
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here's a quick intro for you: https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/