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

I have an ODS pdf that currently produces one file, and within the file are two pages per faculty member at our institution. I made a modification to the code so that there is one file per faculty member with the two needed pages. Is there a way that I can pass the faculty members name from the dataset to the filename? Currently, it is naming the successive files with (1), (2), (3), etc. however, I would like the file to have REPORTNAME_JDOE.PDF, REPORTNAME_DDUCK.PDF, etc. Any direction would be appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Sadly no. 

I wish you could control the names, but you could with a macro/call execute. 

Another option is to rename the files after the fact but I dislike doing that, because it assumes order though I suppose you could check that. There is a RENAME() function that will rename files via a data step. 

 

This illustrates how to do it via macro:

https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md

 


@laura6728 wrote:

I have an ODS pdf that currently produces one file, and within the file are two pages per faculty member at our institution. I made a modification to the code so that there is one file per faculty member with the two needed pages. Is there a way that I can pass the faculty members name from the dataset to the filename? Currently, it is naming the successive files with (1), (2), (3), etc. however, I would like the file to have REPORTNAME_JDOE.PDF, REPORTNAME_DDUCK.PDF, etc. Any direction would be appreciated!


 

 

View solution in original post

1 REPLY 1
Reeza
Super User

Sadly no. 

I wish you could control the names, but you could with a macro/call execute. 

Another option is to rename the files after the fact but I dislike doing that, because it assumes order though I suppose you could check that. There is a RENAME() function that will rename files via a data step. 

 

This illustrates how to do it via macro:

https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md

 


@laura6728 wrote:

I have an ODS pdf that currently produces one file, and within the file are two pages per faculty member at our institution. I made a modification to the code so that there is one file per faculty member with the two needed pages. Is there a way that I can pass the faculty members name from the dataset to the filename? Currently, it is naming the successive files with (1), (2), (3), etc. however, I would like the file to have REPORTNAME_JDOE.PDF, REPORTNAME_DDUCK.PDF, etc. Any direction would be appreciated!


 

 

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
  • 1 reply
  • 1085 views
  • 0 likes
  • 2 in conversation