Hello,
I create a pdf page using two different tables (datasets), i use proc template to manipulate the output of the pdf and proc report to manipulate the data itself (header, etc.). The problem is that i tried but couldn't use 2 templates for my two tables.
Here's the code of what i do:
proc template;
define style styles.sasref;
parent = styles.journal;
style body from Document /
bottommargin = 0cm
topmargin = 0cm
rightmargin = 0cm
leftmargin = 0cm;
style table / rules = groups
frame = box
background = white
bordercolor = black;
style header / foreground = black
font_size = 6pt
font_face = "Arial"
font_weight = medium;
style data / background = white
font_size = 6pt
font_face = "Arial"
cellwidth = 1 cm
cellheight = 10pt
just = center;
end;
run;
options nodate nonumber;
%macro reporting;
%do i = 1 %to &count_of_account;
ods pdf file="&BaseLinux./USR/G681323/SalesForce/Account-BGuido-new.pdf" style=sasref startpage=never;
proc report data = freq_sp_account_tot_pdf nowd;
where cnt_account = &i.;
define prime_acq_pct / display "Primes acquises";
define cnt_account / noprint;
run;
proc report data=prod_portefeuille_account nowd;
where cnt_account = &i.;
define nom_variable / group;* "Caractéristiques";
define cnt_account / noprint;
run;
ods pdf close;
%end;
%mend reporting;
%reporting;
By doing this, i force both tables to follow the same template, but i would like to change the template for the first table.
It would be very helpful if f anyone has an idea....
Thanks.
To use a different ODS style within the same PDF document place and ODS PDF Style= <stylename> before the procedure.
Stub of code:
ODS Pdf file="mypdffile.pdf";
ods pdf style=style1;
<proc report>
ods pdf style=style2;
<proc report>
ods pdf close;
More importantly, why have you put all that code in a macro loop? You will be aware of by group processing?
ods pdf file="&BaseLinux./USR/G681323/SalesForce/Account-B
proc report data = freq_sp_account_tot_pdf nowd;
by cnt_account;
title "You can put titles here and use #byval1 which will be replaced by the by group value";
define prime_acq_pct / display "Primes acquises";
define cnt_account / noprint;
run;
Its quicker, and easier to maintain. Also, not sure your logic is correct, this macro you have here will overwrite the pdf file for each iteration.
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!
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.