BookmarkSubscribeRSS Feed
imath
Calcite | Level 5

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.

2 REPLIES 2
ballardw
Super User

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;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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-BGuido-new.pdf" style=sasref startpage=never;
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.  

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1501 views
  • 0 likes
  • 3 in conversation