An easy way to clear your SAS titles

5

Did you know that if you have set multiple titles in SAS, that there is an easy way to remove them?

For example, suppose that you've written the following statements, which call the TITLE statement to set three titles:

title "A Great Big Papa Title";
title2 "A Medium-sized Mama Title";
title3 "A Wee Little Baby Title";
proc sgplot data=Sashelp.Cars;
   vbar Origin;
run;
titleclear

Now suppose that you want to remove the values of the TITLEn statements. I have always used three statements to remove the values for the TITLE, TITLE2, and TITLE3 statements, as follows:

title;     /* cancel the TITLE  statement */
title2;    /* cancel the TITLE2 statement */
title3;    /* cancel the TITLE3 statement */

However, a SAS colleague informed me that there is an easier way. It turns out that a TITLEn statement clears titles at level n and higher. That is, you do not need to submit a blank TITLE2 and TITLE3 statements. The TITLE statement is sufficient to remove the first-level title as well as all higher-order titles, so you can write the following statement:

title;     /* cancel the TITLE, TITLE2, and TITLE3 statements */

Oh, and in case you are wondering, the same tip applies to the FOOTNOTE statement. When you cancel a FOOTNOTE statement, all higher-order footnotes are also canceled.

Do you know any cool tips for setting or clearing global SAS statements? Share a tip in the comments.

Share

About Author

Rick Wicklin

Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of SAS/IML software. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

5 Comments

  1. Dear all,
    SAS 9.3 supports ten levels for the TITLE statement.

    Before Rick's post I'd used the pile of them to control the interline intervals as follows:

    TITLE1 "This is my title";
    TITLE2;
    TITLE3 "This is my subtitle";

    The post pushed me somehow to think about titles. And I moderated the lines a bit.
    And it worked out :) !

    TITLE1 "This is my title";
    TITLE3 "This is my subtitle";

    What we have is less code. By the way, the trick also works for the FOOTNOTE; statements ;).

    Example:

    DATA GreekLetters;
    	INPUT GreekLetters $ @@;
    	DATALINES;
    	alpha beta gamma
    	;
     
    TITLE1 "title 1";
    TITLE4 "title 4";
    TITLE6 "title 6";
     
    FOOTNOTE1 LINK = 'http://en.wikipedia.org/wiki/Greek_alphabet#Letters' "Wikipedia.org";
    FOOTNOTE3 "footnote 3";
    FOOTNOTE5 "footnote 5";
    FOOTNOTE8 "footnote 8";
     
    PROC PRINT data = GreekLetters NOOBS;
    	RUN;
  2. Pingback: Popular posts from The DO Loop in 2015 - The DO Loop

Leave A Reply

Back to Top