At startup, I'm calling code which uses the SASHELP.VEXTFL dataset to determine the path where the program sits. How can this be used in EG so I can do program editing and testing there?
SAS Enterprise Guide sets a number of global macro variables that you can reference in your code.
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 |
See the list in the EG doc here.
When using a client application like EG or SAS Studio, the client is aware of the original location of a SAS program file but the SAS session doesn't necessarily track it (in the external files table you're relying on). In Base SAS on the PC, the app is both the client (display manager) and the server, so it manages the opening/tracking of these files. But with EG and SAS Studio that responsibility is separate.
You can use some %if/%then logic to detect what environment you're running in (PC SAS, EG, Studio, batch) and set things up accordingly. More work for you.
Also some traditional uses of this (read files or store output in a path relative to the SAS program file location) won't make sense here, because your original SAS file might be on a local machine with EG, while the SAS session is running on a different machine where you cannot directly reference the local machine with your code.
@Doug____ wrote:
At startup, I'm calling code which uses the SASHELP.VEXTFL dataset to determine the path where the program sits. How can this be used in EG so I can do program editing and testing there?
If you want to know where some defined fileref is point use the PATHNAME() function.
If you want to know where the program SAS is running you can just check the SYSIN option value.
Why would you want to query that view? What exactly are you look for?
Are you trying to guess what program the user of Display Manager might have last opened? That might have nothing to do with what statements they submitted.
Are you trying to guess what step in which Enterprise Guide project submitted the current block of code to SAS to run?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.