TIMEPLOT Procedure

PLOT Statement

Specifies the plots to produce.
Tip: Each PLOT statement produces a separate plot.
Plotting a Single Variable

Customizing an Axis and a Plotting Symbol

Using a Variable for a Plotting Symbol

Superimposing Two Plots

Showing Multiple Observations on One Line of a Plot

Syntax

PLOT plot-request(s) </option(s)>;

Summary of Optional Arguments

Control the appearance of the plot
connects the leftmost plotting symbol to the rightmost plotting symbol with a line of hyphens (-).
connects the leftmost and rightmost symbols on each line of the plot with a line of hyphens (-) regardless of whether the symbols are reference symbols or plotting symbols.
suppresses the name of the symbol variable in column headings when you use a CLASS statement.
suppresses the listing of the values of the variables that appear in the PLOT statement.
specifies the number of print positions to use for the horizontal axis.
Create and customize a reference line
draws lines on the plot that are perpendicular to the specified values on the horizontal axis.
specifies the character for drawing reference lines.
Customize the axis
specifies the range of values to plot on the horizontal axis, as well as the interval represented by each print position on the horizontal axis.
orders the values on the horizontal axis with the largest value in the leftmost position.
Display multiple plots on the same set of axes
plots all requests in one PLOT statement on one set of axes.
specifies the character to print if multiple plotting symbols coincide.

Required Argument

plot-request(s)
specifies the variable or variables to plot. (Optional) Also specifies the plotting symbol to use. By default, each plot request produces a separate plot.
A plot request can have the following forms. You can mix different forms of requests in one PLOT statement (see Superimposing Two Plots).
variable(s)
identifies one or more numeric variables to plot. PROC TIMEPLOT uses the first character of the variable name as the plotting symbol.
(variable(s))='plotting-symbol'
identifies one or more numeric variables to plot and specifies the plotting symbol to use for all variables in the list. You can omit the parentheses if you use only one variable.
(variable(s))=symbol-variable
identifies one or more numeric variables to plot and specifies a symbol variable. PROC TIMEPLOT uses the first nonblank character of the formatted value of the symbol variable as the plotting symbol for all variables in the list. The plotting symbol changes from one observation to the next if the value of the symbol variable changes. You can omit the parentheses if you use only one variable.

Optional Arguments

AXIS=axis-specification
specifies the range of values to plot on the horizontal axis, as well as the interval represented by each print position on the axis. PROC TIMEPLOT labels the first and last ends of the axis, if space permits.
For numeric values, axis-specification can be one of the following or a combination of both:
  • n<. . .n>
  • n TO n <BY increment>
The values must be in either ascending or descending order. Use a negative value for increment to specify descending order. The specified values are spaced evenly along the horizontal axis even if the values are not uniformly distributed. Numeric values can be specified in the following ways:
Specification
Comments
axis=1 2 10
Values are 1, 2, and 10.
axis=10 to 100 by 5
Values appear in increments of 5, starting at 10 and ending at 100.
axis=12 10 to 100 by 5
A combination of the two previous forms of specification.
For axis variables that contain datetime values, axis-specification is either an explicit list of values or a starting and an ending value with an increment specified:
  • 'date-time-value'i <. . . 'date-time-value'i>
  • 'date-time-value'i TO 'date-time-value'i
    <BY increment>
'date-time-value'i
any SAS date, time, or datetime value described for the SAS functions INTCK and INTNX. The suffix i is one of the following:
D date
T time
DT datetime
increment
one of the valid arguments for the INTCK or INTNX functions. For dates, increment can be one of the following:
  • DAY
  • WEEK
  • MONTH
  • QTR
  • YEAR
For datetimes, increment can be one of the following:
  • DTDAY
  • DTWEEK
  • DTMONTH
  • DTQTR
  • DTYEAR
For times, increment can be one of the following:
  • HOUR
  • MINUTE
  • SECOND
For example,
axis='01JAN95'd to '01JAN96'd by month 
axis='01JAN95'd to '01JAN96'd by qtr
For descriptions of individual intervals, see the chapter on dates, times, and intervals in SAS Language Reference: Concepts.
Note: You must use a FORMAT statement to print the tick-mark values in an understandable form.
Interaction:The value of POS= (see POS=print-positions-for-plot) overrides an interval set with AXIS=.
Tip: It is possible for your data to be out of range and fall outside the axis area of the plot. When this happens, PROC TIMEPLOT places angle brackets, (< ) or (>), on the sides of the plot to indicate that there is data not being represented.
HILOC
connects the leftmost plotting symbol to the rightmost plotting symbol with a line of hyphens (-).
Interaction:If you specify JOINREF, then PROC TIMEPLOT ignores HILOC.
JOINREF
connects the leftmost and rightmost symbols on each line of the plot with a line of hyphens (-), regardless of whether the symbols are reference symbols or plotting symbols. However, if a line contains only reference symbols, then PROC TIMEPLOT does not connect the symbols.
NOSYMNAME
suppresses the name of the symbol variable in column headings when you use a CLASS statement. If you use NOSYMNAME, then only the value of the symbol variable appears in the column heading.
NPP
suppresses the listing of the values of the variables that appear in the PLOT statement.
OVERLAY
plots all requests in one PLOT statement on one set of axes. Otherwise, PROC TIMEPLOT produces a separate plot for each plot request.
OVPCHAR='character'
specifies the character to print if multiple plotting symbols coincide. If a plotting symbol and a character in a reference line coincide, then PROC TIMEPLOT prints the plotting symbol.
POS=print-positions-for-plot
specifies the number of print positions to use for the horizontal axis.
Default:If you omit both POS= and AXIS=, then PROC TIMEPLOT initially assumes that POS=20. However, if space permits, then this value increases so that the plot fills the available space.
Interaction:If you specify POS=0 and AXIS=, then the plot fills the available space. POS= overrides an interval set with AXIS= . See the discussion of AXIS=axis-specification.
REF=reference-value(s)
draws lines on the plot that are perpendicular to the specified values on the horizontal axis. The values for reference-value(s) can be constants, or you can use the form
MEAN(variable(s))
If you use this form of REF=, then PROC TIMEPLOT evaluates the mean for each variable that you list and draws a reference line for each mean.
Interactions:If you use the UNIFORM option in the PROC TIMEPLOT statement, then the procedure calculates the mean values for the variables over all observations for all BY groups. If you do not use UNIFORM, then the procedure calculates the mean for each variable for each BY group.

If a plotting symbol and a reference character coincide, then PROC TIMEPLOT prints the plotting symbol.

REFCHAR='character'
specifies the character for drawing reference lines.
Default:vertical bar (|)
Interaction:If you are using the JOINREF or HILOC option, then do not specify a value for REFCHAR= that is the same as a plotting symbol. If you do this then PROC TIMEPLOT will interpret the plotting symbols as reference characters and will not connect the symbols as you expect.
REVERSE
orders the values on the horizontal axis with the largest value in the leftmost position.