Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Date range in a local includes 1960

    Hi Community,

    I am trying to specify a date range in my twoway graph (which uses locals), but despite my date range in the data being January 2015 - January 2021, the graph is scaled from 1960. I have played around with altering the graph directly with no luck. There is definitely no year<2015 in my data.
    I thought the issue may be with my date formats, so have included my code used for this too.

    gen modate = ym(YEAR, MONTH)
    format modate %tm

    local naive_tests total_naive modate if TOWN == "Wonderland"
    local target_tests total_target modate if CLINIC =="Fairy Clinic"
    twoway mspline `naive_tests' || mspline `target_tests', ttitle("") ytitle("Test count") tlabel(2015m1(10)2021m1, format(%tm) labsize(small) angle() nogrid) ///
    ylabel(, nogrid)
    Graph.gph

    Thanks in advance for any assistance!

  • #2
    Present your dataset using dataex please.

    Comment


    • #3
      Your graph is not visible. 1st January 1960 has the SIF value 0, so by default it appears that twoway selects this as the starting point.

      Code:
       di %td 0
      Res.:

      Code:
      . di %td 0
      01jan1960
      To restrict the axis, you need the -range()- suboption within -xscale()-, where you specify the starting point. Assuming this is 1st Aug 1999:

      Code:
      xsc(r(`=td(1aug1999)' .))

      Comment

      Working...
      X