Chapter 50: The 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 those 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 may 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 may include variables that do not appear in the plot.

Output 50.1 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 stepExample 1 on page 1313 creates the data set SALES.

 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; 
Output 50.1: Simple Report Created with PROC TIMEPLOT
start example
 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                                                         *-------------------------------* 
end example
 

Output 50.2 is a more complicated report of the same data set that is used to create Output 50.1. The statements that create this report

  • 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.

Output 50.2: More Complex Report Created with PROC TIMEPLOT
start example
 Weekly Appliance Sales for the First Quarter                 1                   Seller :Kreitz   Seller :LeGrange     Month   Week           Stove              Stove     min                    max                                                         4.24          ,910.37                                                        *-------------------------*  January       1   ,312.61          8.13               L    K                January       2     2.35          4.24          !                          January       3   ,263.33          7.35           L                 K       January       4   ,787.45          4.51           L             K           February      1   ,910.37          7.98            L                     K  February      2     9.69        ,242.24                K            L                                                             *-------------------------*                     Weekly Appliance Sales for the First Quarter                 2                           Kreitz          LeGrange     Month   Week          Icebox            Icebox      min                    max                                                         ,520.04        ,550.43                                                        *-------------------------*  January       1   ,450.94       ,520.04           L                      K   January       2   ,240.67       ,675.42               L            K         January       3   ,160.45       ,805.35                  L        K          January       4   ,400.24       ,870.61                    L           K     February      1   ,550.43       ,730.09                L                  K  February      2   ,385.74       ,670.93               L                K                                                           *-------------------------* 
end example
 

For an explanation of the program that produces this report, see Example 5 on page 1322.




Base SAS 9.1.3 Procedures Guide (Vol. 2)
Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4
ISBN: 1590472047
EAN: 2147483647
Year: 2004
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net