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!


 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 720 views
  • 0 likes
  • 2 in conversation