BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lsirakos
Calcite | Level 5

I am trying to write a macro that ends up creating a dataset and I want that dataset to be named whatever the name of the SAS code is that it is run on followed by _STATS.  Basically I am trying to find out if there is a way to create a macro variable that's value is the name of the program currently being run.  This will be part of an automated process so I need it to run without manual intervention.  I was hoping there was an automatic macro variable that had this information but it does not appear to be the case.  Is there a proc or something else that would allow the file name to be stored as a macro variable?

Example:

Program name = Query123.sas

Macro variable to be created = Query123

Thanks

1 ACCEPTED SOLUTION
2 REPLIES 2

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 948 views
  • 1 like
  • 2 in conversation