BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
DrAbhijeetSafai
Lapis Lazuli | Level 10

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

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
1 ACCEPTED SOLUTION
10 REPLIES 10
Amir
PROC Star

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.

DrAbhijeetSafai
Lapis Lazuli | Level 10

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

 

 

 

 

 

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
DrAbhijeetSafai
Lapis Lazuli | Level 10

@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

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
FreelanceReinh
Jade | Level 19

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).";
DrAbhijeetSafai
Lapis Lazuli | Level 10

@FreelanceReinh Many many thanks! This is working perfectly. Thanks. 

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
Amir
PROC Star

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.

DrAbhijeetSafai
Lapis Lazuli | Level 10

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

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
FreelanceReinh
Jade | Level 19

@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.
show_option_menu.png

DrAbhijeetSafai
Lapis Lazuli | Level 10

Many thanks @FreelanceReinh !

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2015 views
  • 7 likes
  • 4 in conversation