In SAS Viya, when running code in SAS Studio, the automatic macro variable _SASPROGRAMFILE contains the full path (or URI) of the program file. However, when running the same program using the VS Code SAS extension, _SASPROGRAMFILE resolves to the filename only, without the directory path.
Is there a way to determine the full path of the program file when running from VS Code? Does SAS Viya expose this information through any existing environment variable, or other macro variable?
Any hints or recommended approaches?
The VS Code extension also adds the _SASPROGRAMFILE macro variable. Example:
%let _SASPROGRAMFILE = %nrquote(%nrstr(c:\Projects\sas-programs-misc\bird-events.sas));
Let me know if you're not seeing that in your case. You can also report issues as needed in the GitHub project:
https://github.com/sassoftware/vscode-sas-extension/issues
May I know what version are you using? I am using the newest version and it does not work.
Below are output of same program file, which has only one statement (%put &=_sasprogramfile;).
SAS Studio output:
_SASPROGRAMFILE=/export/viya/homes/xxxx/Work/test/a.sas
The issue has been reported for almost one year and still open.
https://github.com/sassoftware/vscode-sas-extension/issues/1419
Ah, I see. It's working as expected with local files that you open/create in VS Code, but not for "remote" files that you open from the SAS Content folders. Feel free to comment on the issue in GitHub and see if it can be prioritized for a fix.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.