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

Hello Experts,

 

I'm wondering how to create a file by name. For exemple, in this example we create the file for each name (with obj.open_dir(name: name, label: "", by: 1); 

I would like to add the name on the pdf file like Carte_(name of student).pdf 

 

Do you know please how to variate the name of pdf file by observation ?

title; ods listing close; ods html close; options nodate nonumber; ods escapechar="~"; options papersize=(15cm 10cm); options topmargin=0cm bottommargin=0cm leftmargin=0cm rightmargin=0cm; ods pdf file="Carte.pdf" notoc newfile=Bygroup;
data _null_; set sashelp.class; by name;
if _N_=1 then do; declare odsout obj(); end;
obj.open_dir(name: name, label: "", by: 1);
obj.layout_absolute(overrides: "borderwidth=1"); obj.region(width: "15cm", height: "2cm", overrides: "background=cx494068"); obj.format_text(data: "Groupe Scolaire L. Aragon", overrides: "color=cxbbb2e0 font_size=32pt", just: 'c');

 

Thank you !

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  When you use NEWFILE=BYGROUP the behavior of ODS is to make numbered files, one increment for each by group value. If you want to do something that is data-driven so that the name of the student (or any other data driven value) is used in the FILE= option, you need to investigate using SAS macro variables and/or a SAS macro program. There have been examples of this posted in the past in the forums, so a search should help you find some of those examples.

Cynthia

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  When you use NEWFILE=BYGROUP the behavior of ODS is to make numbered files, one increment for each by group value. If you want to do something that is data-driven so that the name of the student (or any other data driven value) is used in the FILE= option, you need to investigate using SAS macro variables and/or a SAS macro program. There have been examples of this posted in the past in the forums, so a search should help you find some of those examples.

Cynthia

SASdevAnneMarie
Barite | Level 11
Thank you Cynthia,
That works !

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
  • 2 replies
  • 303 views
  • 1 like
  • 2 in conversation