DATA Step, Macro, Functions and more

Mutiple proc prints with title statement within macro-want to see titles only above first table

Reply
Frequent Contributor
Posts: 95

Mutiple proc prints with title statement within macro-want to see titles only above first table

i have a macro that i run .
The macro creates multiple tables with different names and print them.
Before proc print statement i have titles ststements
The problem is that for each tqble that printed out there are titles.
I want that the titles will appear only appove first printed table.
Any solution to this request?
Frequent Contributor
Posts: 95

Re: Mutiple proc prints with title statement within macro-want to see titles only above first table

Hello

i have a macro that i run .
The macro creates multiple tables with different names and print them.
Before proc print statement i have titles ststement.
The problem is that for each table that printed out there are titles.
I want that the titles will appear only above first printed table.
Any solution to this request?

Trusted Advisor
Posts: 1,826

Re: Mutiple proc prints with title statement within macro-want to see titles only above first table

Check next skilton:

 

%let title_flag = 1;  /* initiate title flag to be printed */

 

%macro ....;

    %if &title_flag = 1 %then %do;

           %let title_flag =0;

           title ..... ;

    %end; %else %str(titleSmiley Wink;    /* clear titles */

      ......    your macro program ......

%mend;

PROC Star
Posts: 229

Re: Mutiple proc prints with title statement within macro-want to see titles only above first table

As @Shmuel suggested, use a blank title statement to lear the titles. But I would suggest making the code a bit simpler:

%macro whatever;
  Title '<your inititial title here>';
  %do <assuming you have your print statements in a loop>;
    <proc print statements here>;
    Title;
    %end;
%mend;

In other words, just clear the titles at the end of every iteration; an empty TITLE statement is not very expensive.

Ask a Question
Discussion stats
  • 3 replies
  • 98 views
  • 0 likes
  • 3 in conversation