Loading ...
Sorry, an error occurred while loading the content.

367tabulating by day and hour

Expand Messages
  • Stephen C. Grubb
    Mar 20, 2003
      > I now have a graph of 7 days but each day is only one little bar with
      > the total gets and posts for that day.

      One problem is that you are using 'xscaletype: date' .. this is causing
      all bars within a date to overlap and appear to be just one bar.

      Instead you should be using 'xscaletype: datetime' .. this will produce
      one bar for each unique date+time in your data. proc processdata takes
      care of summing all cases sharing the same date+time.

      > I'd like to at least show the gets and post for each day by hour.

      To tabulate by hour, one method is to use a getdata filter to create a
      data field that is truncated to a round hour value, then use that field
      instead of the original datetime field.

      One other issue-- you probably can't use auto scaling for Y because of the
      summation that proc processdata is performing. Use a fixed Y range

      The following should do what you seek........

      #set ymax = 500000
      #call $setdatefmt( "mm/dd/yy" )
      #set xmax = $todaysdate()
      #set xmin = $dateadd( @xmax, -7 )

      #proc getdata
      fieldnames: datetime hits
      file: hourhits.dat
      select: $daysdiff(@@datetime,@xmin) >= 0
      showresults: yes
      pf_fieldnames: datetime hits date_hr
      ##set DATE_HR = $substring(@@datetime,1,11)
      @@1 @@2 @@DATE_HR:00:00

      #proc areadef
      title: @title
      titledetails: align=L size=16 style=B color=darkblue
      rectangle: 1 1 7.8 2.5
      xscaletype: datetime
      xrange: @xmin.00:00:00 @xmax.24:00:00
      // yautorange datafield=hits nearest=100 margin=200 lowfix=0
      yrange: 0 @ymax
      xaxis.stubs: inc
      xaxis.stubformat: MMMdd
      yaxis.stubs: inc
      yaxis.labeldistance: .8
      frame: yes

      #proc processdata
      action: count
      // fields: datetime hits
      fields: date_hr hits
      showresults: no
      fieldnames: date_hr hits

      #proc bars
      // locfield: datetime
      locfield: date_hr
      lenfield: hits
      truncate: yes
      thinbarline: color=green
    • Show all 9 messages in this topic