Announcement

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

  • Syntax

    Hi all,

    I have a panel dataset from 1974-2014 set to xtreg. I have created a dummy variable ("suffrage_dummy") that takes the value 1 for the year of the introduction of universal suffrage (between this period 1974-2014). I have generated another dummy variable ("suffrage_dummy2") that takes the same value as "suffrage_dummy". I want to replace the values of this "suffrage_dummy2" variable with value 0 conditional on two criteria:

    1. if the year is higher than the establishment of universal suffrage AND
    2. if the average in range (for those years higher than the one when the suffrage is introduced) is lower than 1.

    I was looking at these two sites for inspiration :

    HTML Code:
    https://www.stata.com/statalist/archive/2004-02/msg00759.html#
    HTML Code:
    https://stats.idre.ucla.edu/stata/modules/creating-and-recoding-variables/
    Any help will be much appreciated.

    Ashvinder


  • #2
    Please act according to the advice #3, given to you here.
    Best regards,

    Marcos

    Comment


    • #3
      Dear Marcos,

      Code:
      year    country    v2x_suffr    suffrage_dummy    suffrage_dummy2
      1995    Palestine/West Bank    0    0    
      1996    Palestine/West Bank    1    1    1
      1997    Palestine/West Bank    1    0    
      1998    Palestine/West Bank    1    0    
      1999    Palestine/West Bank    1    0    
      2000    Palestine/West Bank    1    0    
      2001    Palestine/West Bank    1    0    
      2002    Palestine/West Bank    1    0    
      2003    Palestine/West Bank    1    0    
      2004    Palestine/West Bank    1    0    
      2005    Palestine/West Bank    1    0    
      2006    Palestine/West Bank    1    0    
      2007    Palestine/West Bank    1    0    
      2008    Palestine/West Bank    1    0    
      2009    Palestine/West Bank    1    0    
      2010    Palestine/West Bank    1    0    
      2011    Palestine/West Bank    1    0    
      2012    Palestine/West Bank    1    0    
      2013    Palestine/West Bank    1    0    
      2014    Palestine/West Bank    1    0
      Ashvinder

      Comment

      Working...
      X