Previous Page | Next Page

Understanding and Customizing SAS Output: The Basics

Making Output Informative


Adding Titles

At the top of each page of output, SAS automatically writes the following title:

The SAS System

You can make output more informative by using the TITLE statement to specify your own title. A TITLE statement writes the title you specify at the top of every page. The form of the TITLE statement is:

TITLE<n><'text'>;

where n specifies the relative line that contains the title, and text specifies the text of the title. The value of n can be 1 to 10. If you omit n, SAS assumes a value of 1. Therefore, you can specify TITLE or TITLE1 for the first title line. By default, SAS centers a title.

To add the title 'SAT Scores by Year, 1972-1998' to your output, use the following TITLE statement:

title 'SAT Scores by Year, 1972-1998';

The TITLE statement is a global statement. This means that within a SAS session, SAS continues to use the most recently created title until you change or eliminate it, even if you generate different output later. You can use the TITLE statement anywhere in your program.

You can specify up to ten titles per page by numbering them in ascending order. If you want to add a subtitle to your previous title, for example, the subtitle 'Separate Statistics by Test Type,' then number your titles by the order in which you want them to appear. To add a blank line between titles, skip a number as you number your TITLE statements. Your TITLE statements now become

   title1 'SAT Scores by Year, 1972-1998';
   title3 'Separate Statistics by Test Type';

To modify a title line, you change the text in the title and resubmit your program, including all of the TITLE statements. Be aware that a TITLE statement for a given line cancels the previous TITLE statement for that line and for all lines with higher-numbered titles.

To eliminate all titles including the default title, specify

title;

or

title1;

The following example shows how to use multiple TITLE statements.

options linesize=80 pagesize=60 pageno=1 nodate;
libname admin 'SAS-data-library';

data report;
   set admin.sat_scores;
   if year ge 1995 then output;
   title1 'SAT Scores by Year, 1995-1998';
   title3 'Separate Statistics by Test Type';
run;

proc print data=report;
run;

The following output shows the results:

Report Showing Multiple TITLE Statements

                         SAT Scores by Year, 1995-1998                         1
                                        
                        Separate Statistics by Test Type

                  Obs     Test     Gender    Year    SATscore

                    1    Verbal      m       1995       505  
                    2    Verbal      f       1995       502  
                    3    Verbal      m       1996       507  
                    4    Verbal      f       1996       503  
                    5    Verbal      m       1997       507  
                    6    Verbal      f       1997       503  
                    7    Verbal      m       1998       509  
                    8    Verbal      f       1998       502  
                    9    Math        m       1995       525  
                   10    Math        f       1995       490  
                   11    Math        m       1996       527  
                   12    Math        f       1996       492  
                   13    Math        m       1997       530  
                   14    Math        f       1997       494  
                   15    Math        m       1998       531  
                   16    Math        f       1998       496  

Although the TITLE statement can appear anywhere in your program, you can associate the TITLE statement with a particular procedure step by positioning it in one of the following locations:

Remember that the TITLE statement applies globally until you change or eliminate it.


Adding Footnotes

The FOOTNOTE statement follows the same guidelines as the TITLE statement. The FOOTNOTE statement is a global statement. This means that within a SAS session, SAS continues to use the most recently created footnote until you change or eliminate it, even if you generate different output later. You can use the FOOTNOTE statement anywhere in your program.

A footnote writes up to ten lines of text at the bottom of the procedure output or DATA step output. The form of the FOOTNOTE statement is:

FOOTNOTE<n><'text'>;

where n specifies the relative line to be occupied by the footnote, and text specifies the text of the footnote. The value of n can be 1 to 10. If you omit n, SAS assumes a value of 1.

To add the footnote '1967 and 1970 SAT scores estimated based on total number of people taking the SAT,' specify the following statements anywhere in your program:

   footnote1 '1967 and 1970 SAT scores estimated based on total number';
   footnote2 'of people taking the SAT';

You can specify up to ten lines of footnotes per page by numbering them in ascending order. When you alter the text of one footnote in a series and execute your program again, SAS changes the text of that footnote. However, if you execute your program with numbered FOOTNOTE statements, SAS eliminates all higher-numbered footnotes.

footnote;

or

footnote1;

The following example shows how to use multiple FOOTNOTE statements.

options linesize=80 pagesize=30 pageno=1 nodate;
libname admin 'SAS-data-library';

data report;
   set admin.sat_scores;
   if year ge 1996 then output;
   title1 'SAT Scores by Year, 1996-1998';
   title3 'Separate Statistics by Test Type';
   footnote1 '1996 through 1998 SAT scores estimated based on total number';
   footnote2 'of people taking the SAT';
run;

proc print data=report;
run;

The following output shows the results:

Report Showing a Footnote

                         SAT Scores by Year, 1996-1998                         1
                                        
                        Separate Statistics by Test Type

                  Obs     Test     Gender    Year    SATscore

                    1    Verbal      m       1996       507  
                    2    Verbal      f       1996       503  
                    3    Verbal      m       1997       507  
                    4    Verbal      f       1997       503  
                    5    Verbal      m       1998       509  
                    6    Verbal      f       1998       502  
                    7    Math        m       1996       527  
                    8    Math        f       1996       492  
                    9    Math        m       1997       530  
                   10    Math        f       1997       494  
                   11    Math        m       1998       531  
                   12    Math        f       1998       496  
 
 
 
 
 
 
 
 
 
 
            1996 through 1998 SAT scores estimated based on total number
                            of people taking the SAT

Although the FOOTNOTE statement can appear anywhere in your program, you can associate the FOOTNOTE statement with a particular procedure step by positioning it at one of the following locations:

Remember that the FOOTNOTE statement applies globally until you change or eliminate it.


Labeling Variables

In procedure output, SAS automatically writes the variables with the names that you specify. However, you can designate a label for some or all of your variables by specifying a LABEL statement either in the DATA step or, with some procedures, in the PROC step of your program. Your label can be up to 256 characters long, including blanks.

For example, to describe the variable SATscore with the phrase 'SAT Score,' specify

label SATscore ='SAT Score';

If you specify the LABEL statement in the DATA step, the label is permanently stored in the data set. If you specify the LABEL statement in the PROC step, the label is associated with the variable only for the duration of the PROC step. In either case, when a label is assigned, it is written with almost all SAS procedures. The exception is the PRINT procedure. Whether you put the LABEL statement in the DATA step or in the PROC step, with the PRINT procedure you must specify the LABEL option as follows:

proc print data=report label;
run;

The following example shows how to use a label statement.

options linesize=80 pagesize=30 pageno=1 nodate;
libname admin 'SAS-data-library';

data report;
   set admin.sat_scores;
   if year ge 1996 then output;
   label Test='Test Type' 
         SATscore='SAT Score';
   title1 'SAT Scores by Year, 1996-1998';
   title3 'Separate Statistics by Test Type';
run;

proc print data=report label;
run;

The following output shows the results:

Variable Labels in SAS Output

                         SAT Scores by Year, 1996-1998                         1
                                        
                        Separate Statistics by Test Type

                            Test                        SAT
                    Obs     Type     Gender    Year    Score

                      1    Verbal      m       1996     507 
                      2    Verbal      f       1996     503 
                      3    Verbal      m       1997     507 
                      4    Verbal      f       1997     503 
                      5    Verbal      m       1998     509 
                      6    Verbal      f       1998     502 
                      7    Math        m       1996     527 
                      8    Math        f       1996     492 
                      9    Math        m       1997     530 
                     10    Math        f       1997     494 
                     11    Math        m       1998     531 
                     12    Math        f       1998     496 

Developing Descriptive Output

The following example incorporates the TITLE, LABEL, and FOOTNOTE statements, and produces output.

options linesize=80 pagesize=40 pageno=1 nodate; 
libname admin 'SAS-data-library';

proc sort data=admin.satscores;
   by gender;
run;

proc means data=admin.satscores maxdec=2 fw=8;
   by gender;
   label SATscore='SAT score';
   title1 'SAT Scores by Year, 1967-1976';
   title3 'Separate Statistics by Test Type';
   footnote1 '1972 and 1976 SAT scores estimated based on the';
   footnote2 'total number of people taking the SAT';
run;

The following output shows the results:

Titles, Labels, and Footnotes in SAS Output

                         SAT Scores by Year, 1967-1976                         1
                                        
                        Separate Statistics by Test Type

----------------------------------- Gender=f -----------------------------------

                              The MEANS Procedure

   Variable    Label        N        Mean     Std Dev     Minimum     Maximum
   --------------------------------------------------------------------------
   Year                     4     1975.00        2.58     1972.00     1978.00
   SATscore    SAT score    4      515.00       11.75      503.00      529.00
   --------------------------------------------------------------------------


----------------------------------- Gender=m -----------------------------------

   Variable    Label        N        Mean     Std Dev     Minimum     Maximum
   --------------------------------------------------------------------------
   Year                     4     1975.00        2.58     1972.00     1978.00
   SATscore    SAT score    4      519.25        9.95      511.00      531.00
   --------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                1972 and 1976 SAT scores estimated based on the
                     total number of people taking the SAT

Previous Page | Next Page | Top of Page