The SAS Output Delivery System and reporting techniques

macro in proc report

Reply
Frequent Contributor
Posts: 115

macro in proc report

%macro increaseSlideNo();
  %let slideNo = %sysfunc(putn(%eval(&slideNo + 1),z03.));
%mend increaseSlideNo;

To fulfil for one my requirement, I've to use below title and macro statements in each page break in proc report.

title  "#6A&slideNo.#SUMMARY REPORT"; 

%increaseSlideNo;

would it be possible to use above two statements in page break in proc report


SAS Super FREQ
Posts: 8,641

Re: macro in proc report

Hi:

  A SAS TITLE statement can only get issued BETWEEN procedure steps. That is your only opportunity to change the SAS TITLE. Without seeing the code for how you are generating the page break in PROC REPORT (using BY, using PAGE on BREAK??), it is hard to make a constructive comment. If you were using BY group processing, it is possible to use the special BY variables to get the title to change for a BY group.

  PROC REPORT does have the COMPUTE block, you could try COMPUTE BEFORE _PAGE_ -- but the text is within the boundary of the table, not at the top of the physical page. You did not say what your destination of interest was. You did not show any code other than your TITLE statement.

  Also, you did not show what is "inside" the %increaseSlideNo macro program -- for example, if there were only macro statement inside the macro program it might work. However, if there were an entire DATA step program or a PROC SQL step or any other procedure step inside the macro program, you cannot have the macro program generate any statements that would force a step boundary in PROC REPORT.

  For example, compare the placement of a BY variable in the title compared to the placement of the AGE value (coming from the COMPUTE BEFORE _PAGE_) in the attached screenshot.

cynthia

proc sort data=sashelp.class out=class;

by age sex name;

where age in (13, 14, 15);

run;

    

options nobyline nodate nonumber;

ods listing close;

    

ods html file='c:\temp\class.html';

ods rtf file='c:\temp\class.rtf';

ods pdf file='c:\temp\class.pdf';

   

proc report data=class nowd;

  title 'From BY Processing: Age is #Byval1';

  by age;

  column age sex name height weight;

  define age / group noprint;

  define sex / order;

  define name / order;

  define height / display;

  define weight / display;

  break after age / page;

  compute before _page_ /

          style={just=c font_weight=bold};

    disp_line = "From Compute Block Age is:"||trim(put(age,2.0))||" Summary Report";

    line disp_line $50.;

  endcomp;

run;

 

ods _all_ close;

title;

options byline;

Attachment
Post a Question
Discussion Stats
  • 1 reply
  • 525 views
  • 0 likes
  • 2 in conversation