TIMEPLOT Procedure

Overview: TIMEPLOT Procedure

The TIMEPLOT procedure plots one or more variables over time intervals. A listing of variable values accompanies the plot. Although the plot and the listing are similar to the ones produced by the PLOT and PRINT procedures, PROC TIMEPLOT output has these distinctive features:
  • The vertical axis always represents the sequence of observations in the data set. Thus, if the observations are in order of date or time, then the vertical axis represents the passage of time.
  • The horizontal axis represents the values of the variable that you are examining. Like PROC PLOT, PROC TIMEPLOT can overlay multiple plots on one set of axes so that each line of the plot can contain values for more than one variable.
  • A plot produced by PROC TIMEPLOT can occupy more than one page.
  • Each observation appears sequentially on a separate line of the plot; PROC TIMEPLOT does not hide observations as PROC PLOT sometimes does.
  • The listing of the plotted values can include variables that do not appear in the plot.
The following output illustrates a simple report that you can produce with PROC TIMEPLOT. This report shows sales of refrigerators for two sales representatives during the first six weeks of the year. The statements that produce the output follow. A DATA step in Plotting a Single Variable creates the data set SALES.
title 'The SAS System';
options source;
options linesize=64 pagesize=60 nodate
        pageno=1;
proc timeplot data=sales;
   plot icebox;
   id month week;
   title 'Weekly Sales of Refrigerators';
   title2 'for the';
   title3 'First Six Weeks of the Year';
run;
Simple Report Created with PROC TIMEPLOT
                 Weekly Sales of Refrigerators                 1
                            for the
                  First Six Weeks of the Year

Month     Week      Icebox      min                          max
                                2520.04                  3550.43
                               *-------------------------------*
    1        1     3450.94     |                            I  |
    1        1     2520.04     |I                              |
    1        2     3240.67     |                      I        |
    1        2     2675.42     |     I                         |
    1        3     3160.45     |                   I           |
    1        3     2805.35     |         I                     |
    1        4     3400.24     |                          I    |
    1        4     2870.61     |           I                   |
    2        1     3550.43     |                              I|
    2        1     2730.09     |      I                        |
    2        2     3385.74     |                          I    |
    2        2     2670.93     |     I                         |
                               *-------------------------------*
The following output is a more complicated report of the same data set that is used to create Simple Report Created with PROC TIMEPLOT. The statements that create this report do the following:
  • create one plot for the sale of refrigerators and one for the sale of stoves
  • plot sales for both sales representatives on the same line
  • identify points on the plots by the first letter of the sales representative's last name
  • control the size of the horizontal axis
  • control formats and labels
For an explanation of the program that produces this report, see Showing Multiple Observations on One Line of a Plot .
More Complex Report Created with PROC TIMEPLOT
                 Weekly Appliance Sales for the First Quarter                 1

                Seller :Kreitz  Seller :LeGrange
   Month  Week           Stove             Stove      min                    max
                                                      $184.24          $2,910.37
                                                     *-------------------------*
January      1   $1,312.61         $728.13           |     L    K              |
January      2     $222.35         $184.24           |!                        |
January      3   $2,263.33         $267.35           | L                 K     |
January      4   $1,787.45         $274.51           | L             K         |
February     1   $2,910.37         $397.98           |  L                     K|
February     2     $819.69       $2,242.24           |      K            L     |
                                                     *-------------------------*
                  Weekly Appliance Sales for the First Quarter                 2

                        Kreitz          LeGrange
   Month  Week          Icebox            Icebox      min                    max
                                                      $2,520.04        $3,550.43
                                                     *-------------------------*
January      1   $3,450.94       $2,520.04           |L                      K |
January      2   $3,240.67       $2,675.42           |    L            K       |
January      3   $3,160.45       $2,805.35           |       L        K        |
January      4   $3,400.24       $2,870.61           |         L           K   |
February     1   $3,550.43       $2,730.09           |     L                  K|
February     2   $3,385.74       $2,670.93           |    L                K   |
                                                     *-------------------------*