The SAS Output Delivery System and reporting techniques

Proc template proc report

Reply
Occasional Contributor
Posts: 7

Proc template proc report

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.

Grand Advisor
Posts: 9,748

Re: Proc template proc report

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;

Esteemed Advisor
Esteemed Advisor
Posts: 6,726

Re: Proc template proc report

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.  

Post a Question
Discussion Stats
  • 2 replies
  • 339 views
  • 0 likes
  • 3 in conversation