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; |
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.
5 Comments
Or, instead of clearing them, sometimes you might need to put them back the way that you found them.
Similar to Chris' suggestion in resetting the options, Mark Jordan (aka SASJedi) shares a helpful macro to do this in his blog post - http://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options/
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:
The post pushed me somehow to think about titles. And I moderated the lines a bit.
And it worked out :) !
What we have is less code. By the way, the trick also works for the FOOTNOTE; statements ;).
Example:
Pingback: Popular posts from The DO Loop in 2015 - The DO Loop
Thankyou soo much it works.:)