While this discussion accurately tells how to display last dataset used in the programme, I was thinking if there is a way to display the name of the programme inside the output?
If there is no way, then simply manually typing it in title or footnote is the solution but I would like to know if there is any way by which I can do it automatically so that I need not type it manually in each programme.
Thanks in advance!
-- Dr. Abhijeet Safai
One approach:
title "Currently the program is %sysfunc(getoption(sysin))";
Also see:
Hi,
If you are using Enterprise Guide then Special automatic macro variables available in SAS Enterprise Guide might be of help, in particular _sasprogramfile.
Thanks & kind regards,
Amir.
Thanks @Amir for the information.
I am using Base SAS. So in short, it is not available on Base SAS it seems. But thanks for sharing that it is available on Enterprise Guide.
Thanking you,
Yours sincerely,
- Dr. Abhijeet Safai
One approach:
title "Currently the program is %sysfunc(getoption(sysin))";
Also see:
@Astounding This is working! So many thanks. There is a minor change which will need to be made though. It is showing 'full path' but I need only the name of the programme. I will make changes for that but your answer is very very helpful. Many thanks!
- Dr. Abhijeet Safai
Hello @DrAbhijeetSafai,
See "Example 6: How to Retrieve the Program Name That Is Currently Running in Batch Mode or Interactively" in the documentation for more options, in particular the Windows environment variables SAS_EXECFILENAME and SAS_EXECFILEPATH if you're running a program interactively.
Example:
title "This is program %sysget(sas_execfilename).";
@FreelanceReinh Many many thanks! This is working perfectly. Thanks.
- Dr. Abhijeet Safai
Hi,
Feel free to mark another post (instead of mine) as the solution, as they are closer to what you were looking for.
Thanks & kind regards,
Amir.
Yes, I agree. However, it seems that it is not in my hands. I request admins to kindly mark this answer by @Astounding as the accepted solution by removing the current answer by @Amir as a solution. Also, kindly feel free to delete this message.
Thanks in advance.
- Dr. Abhijeet Safai
@DrAbhijeetSafai wrote:
Yes, I agree. However, it seems that it is not in my hands.
Normally you can do it:
Select a different post as the solution after clicking "Not the Solution" in the option menu (see icon below) of the current solution.
Many thanks @FreelanceReinh !
- Dr. Abhijeet Safai
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 lock in 2025 pricing—just $495!
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.