dmag

How to download and try this example

Usage: pl -gif dmag.htm

// Contributed by Dan DeMaggio dmag@wellersoft.com

#proc page #proc getdata file: dmag.csv //showresults: yes delimit: comma // About the fileformat: // 1 = date // 2 = INR (a lab test value) // 3 = Weekly Dose of the drug they take // 4,5 = Target range (H/L) where INR is supposed to be // 6 = Set if they had an Adverse reaction (puts a little dot on the axis) // 7,8,9 = One of these three will be set to 1 depending on the patient // status: Not Managed, Managed Elsewhere or Managed // When not managed, everything is colored dark grey during that time // When Elsewhere, things are painted light grey behind the graph // When managed, nothing is done. // These three are mutually exclusive. 1=true, 0=false. // ------------------------------ top area: Dose #proc areadef rectangle: .6 1.8 6.2 2.4 xscaletype: date yyyymmdd xautorange: datafield=1 nearest=month yautorange: datafield=3 nearest=5 #proc xaxis stubs: inc 1 month stubformat: '' grid: color=skyblue #proc yaxis stubs: inc 10 grid: color=skyblue label: Dose (mg/wk) // Plot dose #proc lineplot yfield: 3 xfield: 1 stairstep: yes // ----------------- bottom area: Managed #proc areadef rectangle: .6 1 6.2 1.6 xscaletype: date yyyymmdd xautorange: datafield=1 nearest=month yrange: 0 1 // ------------------- Managed Elsewhere (behind) #proc lineplot xfield: 1 yfield: 8 fill: rgb(.81,.81,.81) stairstep: yes legendlabel: Managed Elsewhere // ---------------- INR area, axis #proc areadef rectangle: .6 1 6.2 1.6 xscaletype: date yyyymmdd xautorange: datafield=1 nearest=month yautorange: datafield=2 nearest=4 lowfix=0 #proc xaxis stubs: inc 1 month stubformat: M autoyears: yyyy grid: color=skyblue #proc yaxis stubs: inc 2 grid: color=skyblue label: INR // ------------------- INR TARGET #proc rangesweep lofield: 5 hifield: 4 xfield: 1 color: powderblue select: @@4 > .1 && @@5 > .1 legendlabel: Target INR Range // ------------------------- INR #proc lineplot yfield: 2 xfield: 1 linedetails: color=red pointsymbol: shape=diamond style=fill fillcolor=black radius=.03 select @@2 > 0 legendlabel: INR // ----------------- bottom (Not Managed) area #proc areadef rectangle: .6 1 6.2 1.6 xscaletype: date yyyymmdd xautorange: datafield=1 nearest=month yrange: 0 1 #saveas: A // ------------------- Managed (Not Managed) foreground #proc lineplot xfield: 1 yfield: 7 fill: rgb(.3,.3,.3) stairstep: yes legendlabel: Not Managed //--------------------- Adverse #proc scatterplot ylocation: 0(s) xfield: 1 symbol: shape=diamond radius=.06 style=fill fillcolor=red select: $strlen(@@6) > 1 //verticletext: yes //labelfield: 6 //text: 6 legendlabel: Adverse Event // ------------------- Legend #proc legend format: singleline // Loc bot location: min min-.5 // Loc top //location: min max+1.5 sep .5 outlinecolors: yes specifyorder: INR Target INR Range Adverse Managed Elsewhere Not Managed