Announcement

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

  • Creating a dummy variable that selects the data

    • I've created dummy variables for treatment and comparison group (treat1) and for the Minimum Wage Increase Period(NMW). I wanted to create a dummy variable that takes all the observations for the ID variable in all the years we're looking at, not just the NMW period.
    • So I wanted to create pp=1 for when treat1 =0/1 and NMW=1 for sa_id for three years prior to Min Wage increase and three years of the increase i.e. 2009-2011 and 2012-2014.
    • How would I go about doing this?
    I would be very grateful for any help!

  • #2
    Welcome to Statalist.

    Without knowing the structure of the data it's hard to tell. Please follow the FAQ (https://www.statalist.org/forums/help) and use -dataex- to provide some sample data.

    Comment


    • #3
      Hello,

      Thanks for your response. The data I'm working on is confidential and I can't access it outside of a VPN. I've created a sample data file and uploaded it here.

      My question is how do I create pp=1 for when treat1 =0/1 and NMW=1 for all values of sa_id in the years 2011-2014.
      sa_id year treat1 NMW pp
      abc1 2008
      abc1 2009
      abc1 2010
      abc1 2011 1
      abc1 2012 1
      abc1 2013 1
      abc1 2014 1
      def1 2008
      def1 2009
      def1 2010
      def1 2011 1
      def1 2012 1
      def1 2013 1
      def1 2014 1
      geh1 2008
      geh1 2009
      geh1 2010
      geh1 2011 0
      geh1 2012 1
      geh1 2013 1
      geh1 2014 1

      Comment

      Working...
      X