# caselist.p

    // Usage: pltab caselist.tab

    //  This ploticus script will be invoked by pltab to embed graphics
    // within the table caselist.tab

    #declare ID

    // get data using proc getdata
    #proc getdata
      file: ../gallery/vf.dat

    // set up plotting area using proc areadef
    #proc areadef
      yscaletype: pltab
      xrange: 0 12

    // do bottom X axis using proc xaxis
    #proc xaxis
      stubs: inc 2
      label: Number of months
      location: min-0.2
      #saveas XAX

    // do top X axis using proc xaxis
    #proc xaxis
      #clone XAX
      location: max+0.4
      ticlen: -0.05
      stubdetails: adjust=0,0.3
      labeldetails: adjust=0,0.8

    // now loop through the row stubs..
    #loop
      // get the next stub..
      #set ID = $nextstub(5)
      // when end of page is reached, $nextstub will return a zero length string ..
      #if $strlen(@ID) < 1
        #break
      #endif

      #proc print
      label: @ID

      // select the case of interest; it alone will become the 'current' data
      // however the original data set will still reside in memory (proc transform)
      #proc transform
        action: select
        select: @@1 = @ID
        stack: yes

      // change from one row of data to one column of data, since proc lineplot
      // uses data by field position (proc transform)
      #proc transform
        action: rotate
        rejectfields: 1 2 3 4
        stack: yes

      // now set up a little plotting area using pltabrow scale type (proc areadef)
      #proc areadef
        yscaletype: pltabrow @ID
        xrange: 0 12
        yrange: 0 100
        pltabrowy: -.2 .1
        yaxis.stubs: none
        yaxis.tics: none

      // do the lineplot for the case using proc lineplot
      #proc lineplot
        yfield: 1
        stairstep: yes
        lastseglen: 1(s)

      // do the dotted reference line using proc lineplot
      #proc line
        notation: scaled
        linedetails: color=green width=0.2 style=1 dashscale=2
        points: @XSTART @YSTART 12 @YSTART

      // reset so that we are referencing the original (big) data set again proc originaldata
      #proc originaldata

    #endloop