Announcement

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

  • Restricting Scatter Plot to a specific time frame in Stata

    I have data for elections from 1880 to 2008, and I would like to create a scatter of Vote against Growth, but just for the years from 1916 to 2008. How do I create a scatter plot with this time frame restriction? Is my code still going to be: scatter vote growth
    Also, if the time frame was changed from 1916 to 2004, what is my new code going to be? Thank you

  • #2
    I don't know how time is specified in your dataset, but if you just have a variable YEAR that has the year date (not a Stata date variable):

    Code:
    scatter vote growth if YEAR>=1880 & YEAR<=2008
    scatter vote growth if YEAR>=1916 & YEAR<=2004
    Stata/MP 14.1 (64-bit x86-64)
    Revision 19 May 2016
    Win 8.1

    Comment


    • #3
      A cleaner version of what Carole J. Wilson suggested would be:

      Code:
      tw scatter vote growth if inrange(year, 1880, 2008)
      tw scatter vote growth if inrange(year, 1916, 2004)
      It requires a few less keystrokes and can make the intention clearer (particularly if you need/want to include other conditions for the command).

      Comment

      Working...
      X