# km

How to download and try this example

    Usage: pl -gif km.htm
    Note: the simplistic technique used herein for coloring the
    overlapping ranges only works when one range is always below the other.

    //  Set up plotting region using proc areadef
    #proc areadef
      title: Kaplan-Meier Example
      titledetails: size=14  align=C
      areaname: slide
      // 'slide' is equivalent to: lower left at 1 0.7 and upper right at 5.85 3.2
      yrange: 0 1
      xrange: 0 60
      xaxis.stubs: incremental 6
      xaxis.label: Months
      yaxis.stubs: incremental 0.1
      yaxis.stubformat: %3.1f

    //  Get data (from end of this file) using proc getdata
    #proc getdata
      #intrailer

    //  do the blue range using proc rangesweep
    #proc rangesweep
      xfield: 1
      lofield: 3
      hifield: 4
      color: powderblue
      legendlabel: 95% CI Group A

    //  do the pink range using proc rangesweep
    #proc rangesweep
      xfield: 1
      lofield: 6
      hifield: 7
      color: pink
      legendlabel: 95% CI Group B

    //  do the yellow range which shows overlap using proc rangesweep
    #proc rangesweep
      xfield: 1
      lofield: 6
      hifield: 4
      color: rgb(0.8,1,0.8)
      legendlabel: Overlap of CIs

    //  now do the curves last so they come out on top of ranges..

    //  do the blue curve using proc lineplot
    #proc lineplot
      xfield: 1
      yfield: 2
      linedetails: color=blue
      legendlabel: Group A

    //  do the red curve using proc lineplot
    #proc lineplot
      xfield: 1
      yfield: 5
      linedetails: color=red
      legendlabel: Group B

    //  render the legend using proc legend
    #proc legend
      location: max-1 max
      seglen: 0.2
      specifyorder:
    	Group A
    	95% CI Group A
    	Group B
    	95% CI Group B
    	Overlap

    //  here is the data...
    #proc trailer
    data:
    //      T       val1    lo1     hi1     val2    lo2     hi2
    	0       1       1       1       1       1       1
    	1       0.993   0.986   1.000   0.9895  0.981   0.998
    	2       0.9915  0.984   0.999   0.98    0.968   0.992
    	3       0.9845  0.974   0.995   0.972   0.958   0.986
    	4      0.9725  0.959   0.986   0.9625  0.946   0.979
    	5      0.937   0.916   0.958   0.9285  0.906   0.951
    	6      0.892   0.865   0.919   0.884   0.856   0.912
    	8      0.8335  0.801   0.866   0.8365  0.804   0.869
    	10      0.78    0.744   0.816   0.782   0.746   0.818
    	12      0.741   0.703   0.779   0.7585  0.721   0.796
    	14      0.6855  0.645   0.726   0.726   0.687   0.765
    	16      0.6565  0.615   0.698   0.6945  0.654   0.735
    	18      0.628   0.586   0.670   0.6595  0.618   0.701
    	20      0.607   0.564   0.650   0.6385  0.596   0.681
    	22      0.5685  0.525   0.612   0.6155  0.572   0.659
    	24      0.561   0.517   0.605   0.6035  0.560   0.647
    	26      0.536   0.491   0.581   0.569   0.524   0.614
    	28      0.514   0.469   0.559   0.539   0.493   0.585
    	30      0.497   0.451   0.543   0.5155  0.469   0.562
    	32      0.474   0.427   0.521   0.509   0.465   0.553
    	34      0.4635  0.416   0.511   0.4885  0.441   0.536
    	36      0.444   0.396   0.492   0.469   0.420   0.518
    	38     0.444   0.396   0.492   0.442   0.391   0.493
    	40     0.424   0.374   0.474   0.4365  0.385   0.488
    	42     0.4115  0.360   0.463   0.4305  0.379   0.482
    	44     0.403   0.350   0.456   0.4235  0.371   0.476
    	46     0.3865  0.331   0.442   0.415   0.361   0.469
    	48     0.3755  0.318   0.433   0.394   0.335   0.453
    	50     0.356   0.290   0.422   0.394   0.335   0.453