Syntax: TIMEPLOT Procedure


Requirements: At least one PLOT statement

Tip: Supports the Output Delivery System. See Output Delivery System on page 32 for details.

ODS Table Names: See: ODS Table Names on page 1312

Reminder: You can use the ATTRIB, FORMAT, LABEL, and WHERE statements. See Chapter 3, Statements with the Same Function in Multiple Procedures, on page 57 for details. You can also use any global statements. See Global Statements on page 18 for a list.

PROC TIMEPLOT < option(s) >;

  • BY <DESCENDING> variable-1

    • < <DESCENDING> variable-n >

    • <NOTSORTED>;

  • CLASS variable(s) ;

  • ID variable(s) ;

  • PLOT plot-request(s) / option(s) ;

To do this

Use this statement

Produce a separate plot for each BY group

BY

Group data according to the values of the class variables

CLASS

Print in the listing the values of the variables that you identify

ID

Specify the plots to produce

PLOT

PROC TIMEPLOT Statement

PROC TIMEPLOT < option(s) >;

Options

DATA= SAS-data-set

  • identifies the input data set.

MAXDEC= number

  • specifies the maximum number of decimal places to print in the listing.

  • Interaction: A decimal specification in a format overrides a MAXDEC= specification.

  • Default: 2

  • Range: 0-12

  • Featured in: Example 4 on page 1320

SPLIT= split-character

  • specifies a split character, which controls line breaks in column headings. It also specifies that labels be used as column headings. PROC TIMEPLOT breaks a column heading when it reaches the split character and continues the heading on the next line. Unless the split character is a blank, it is not part of the column heading. Each occurrence of the split character counts toward the 256-character maximum for a label.

  • Alias: S=

  • Default: blank ( )

    Note: Column headings can occupy up to three lines. If the column label can be split into more lines than this fixed number, then the split character is used only as a recommendation on how to split the label.

UNIFORM

  • uniformly scales the horizontal axis across all BY groups. By default, PROC TIMEPLOT separately determines the scale of the axis for each BY group.

  • Interaction: UNIFORM also affects the calculation of means for reference lines (see REF= on page 1311).

BY Statement

Produces a separate plot for each BY group.

Main discussion: BY on page 58

BY <DESCENDING> variable-1

  • < <DESCENDING> variable-n >

  • <NOTSORTED>;

Required Arguments

variable

  • specifies the variable that the procedure uses to form BY groups. You can specify more than one variable. If you do not use the NOTSORTED option in the BY statement, then either the observations in the data set must be sorted by all the variables that you specify, or they must be indexed appropriately. These variables are called BY variables .

Options

DESCENDING

  • specifies that the data set is sorted in descending order by the variable that immediately follows the word DESCENDING in the BY statement.

NOTSORTED

  • specifies that observations are not necessarily sorted in alphabetic or numeric order. The data is grouped in another way, for example, chronological order.

    The requirement for ordering or indexing observations according to the values of BY variables is suspended for BY-group processing when you use the NOTSORTED option. In fact, the procedure does not use an index if you specify NOTSORTED. The procedure defines a BY group as a set of contiguous observations that have the same values for all BY variables. If observations that have the same values for the BY variables are not contiguous, then the procedure treats each contiguous set as a separate BY group.

CLASS Statement

Groups data according to the values of the class variables.

Tip: PROC TIMEPLOT uses the formatted values of the CLASS variables to form classes. Thus, if a format groups the values, then the procedure uses those groups.

Featured in: Example 5 on page 1322

CLASS variable(s) ;

Required Arguments

variable(s)

  • specifies one or more variables that the procedure uses to group the data. Variables in a CLASS statement are called class variables . Class variables can be numeric or character. Class variables can have continuous values, but they typically have a few discrete values that define the classifications of the variable. You do not have to sort the data by class variables.

    The values of the class variables appear in the listing. PROC TIMEPLOT prints and plots one line each time the combination of values of the class variables changes. Therefore, the output typically is more meaningful if you sort or group the data according to values of the class variables.

Using Multiple CLASS Statements

You can use any number of CLASS statements. If you use more than one CLASS statement, then PROC TIMEPLOT simply concatenates all variables from all of the CLASS statements. The following form of the CLASS statement includes three variables:

  • CLASS variable-1 variable-2 variable-3 ;

  • It has the same effect as this form:

  • CLASS variable-1 ;

  • CLASS variable-2 ;

  • CLASS variable-3 ;

Using a Symbol Variable

Normally, you use the CLASS statement with a symbol variable (see the discussion of plot requests on page 1308). In this case, the listing of the plot variable contains a column for each value of the symbol variable, and each row of the plot contains a point for each value of the symbol variable. The plotting symbol is the first character of the formatted value of the symbol variable. If more than one observation within a class has the same value of a symbol variable, then PROC TIMEPLOT plots and prints only the first occurrence of that value and writes a warning message to the SAS log.

ID Statement

Prints in the listing the values of the variables that you identify.

Featured in: Example 1 on page 1313

ID variable(s) ;

Required Arguments

variable(s)

  • identifies one or more ID variables to print in the listing.

PLOT Statement

Specifies the plots to produce.

Tip: Each PLOT statement produces a separate plot.

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

Table 50.1 on page 1307 summarizes the options that are available in the PLOT statement.

Table 50.1: Summary of Options for the PLOT Statement

To do this

Use this option

Customize the axis

 

Specify the range of values to plot on the horizontal axis, as well as the interval represented by each print position on the horizontal axis

AXIS=

 

Order the values on the horizontal axis with the largest value in the leftmost position

REVERSE

Control the appearance of the plot

 

Connect the leftmost plotting symbol to the rightmost plotting symbol with a line of hyphens (-)

HILOC

 

Connect 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

JOINREF

 

Suppress the name of the symbol variable in column headings when you use a CLASS statement

NOSYMNAME

 

Suppress the listing of the values of the variables that appear in the PLOT statement

NPP

 

Specify the number of print positions to use for the horizontal axis

POS=

Create and customize a reference line

 

Draw lines on the plot that are perpendicular to the specified values on the horizontal axis

REF=

 

Specify the character for drawing reference lines

REFCHAR=

Display multiple plots on the same set of axes

 

Plot all requests in one PLOT statement on one set of axes

OVERLAY

 

Specify the character to print if multiple plotting symbols coincide

OVPCHAR=

Required Arguments

plot-request(s)

  • specifies the variable or variables to plot and, optionally , 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 Example 4 on page 1320).

  • variable(s)

    • identifies one or more numeric variables to plot. PROC TIMEPLOT uses the first character of the variable name as the plotting symbol.

    • Featured in: Example 1 on page 1313

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

    • Featured in: Example 2 on page 1315

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

    • Featured in: Example 3 on page 1317

Options

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= on page 1310) overrides an interval set with AXIS=.

  • Tip: If the range that you specify does not include all your data, then PROC TIMEPLOT uses angle brackets (< or >) on the left or right border of the plot to indicate a value that is outside the range.

  • Featured in: Example 2 on page 1315

HILOC

  • connects the leftmost plotting symbol to the rightmost plotting symbol with a line of hyphens (-).

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

  • Featured in: Example 3 on page 1317

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.

  • Featured in: Example 5 on page 1322

NPP

  • suppresses the listing of the values of the variables that appear in the PLOT statement.

  • Featured in: Example 3 on page 1317

OVERLAY

  • plots all requests in one PLOT statement on one set of axes. Otherwise, PROC TIMEPLOT produces a separate plot for each plot request.

  • Featured in: Example 4 on page 1320

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.

  • Default: at sign (@)

  • Featured in: Example 5 on page 1322

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= on page 1308).

  • See also: Page Layout on page 1311

  • Featured in: Example 1 on page 1313

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) may be constants, or you may 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.

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

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

  • Featured in: Example 3 on page 1317 and Example 4 on page 1320

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, because PROC TIMEPLOT will interpret the plotting symbols as reference characters and will not connect the symbols as you expect.

  • Featured in: Example 3 on page 1317

REVERSE

  • orders the values on the horizontal axis with the largest value in the leftmost position.

  • Featured in: Example 4 on page 1320




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