Hello everyone,
I have a panel dataset covering US states and counties for a number of years and quarters. For each county I have also the list of banks operating there, in the specific time period. Therefore a county is repeated many times. There is a variable 'treated" indicating with 1 whereas in a certain county in a certain year there was a specific event (say an election). I want to create two time dummies. The first one taking value of 1 in each of the three years before that event, the other one taking value one for the three years following the event. The dataset looks like this:
input str20 state str33 county double date float(treated year) byte quarter
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"LOUISIANA" "East Baton Rouge Parish" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"LOUISIANA" "Jefferson Parish" 20080331 0 2008 3
"LOUISIANA" "Tangipahoa Parish" 20120331 0 2012 3
"ALABAMA" "Baldwin County" 20040331 0 2004 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"VIRGINIA" "Chesterfield County" 20030331 0 2003 3
"TEXAS" "Harris County" 20050331 0 2005 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 19980331 0 1998 3
"TEXAS" "Harris County" 20080331 0 2008 3
"MISSISSIPPI" "Desha County" 20050331 0 2005 3
"VIRGINIA" "King and Queen County" 19990331 0 1999 3
"TEXAS" "Harris County" 20080331 0 2008 3
"LOUISIANA" "East Baton Rouge Parish" 20120331 0 2012 3
"TEXAS" "Harris County" 20050331 0 2005 3
"TEXAS" "Washington County" 20080331 0 2008 3
"LOUISIANA" "Harrison County" 20080331 0 2008 3
"TEXAS" "Calhoun County" 19980331 0 1998 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"VIRGINIA" "Southampton County" 19990331 0 1999 3
"NORTH CAROLINA" "Wilson County" 20110331 0 2011 3
"TEXAS" "Harris County" 20080331 0 2008 3
"VIRGINIA" "Fairfax County" 20030331 0 2003 3
"TEXAS" "Harris County" 20080331 0 2008 3
"FLORIDA" "Collier County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"LOUISIANA" "La Salle Parish" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"ALABAMA" "Baldwin County" 20040331 0 2004 3
"LOUISIANA" "Jefferson Parish" 20080331 0 2008 3
"LOUISIANA" "East Baton Rouge Parish" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20080331 0 2008 3
"LOUISIANA" "Iberia Parish" 20120331 0 2012 3
"TEXAS" "Harris County" 20080331 0 2008 3
"TEXAS" "Harris County" 20050331 0 2005 3
"ALABAMA" "Baldwin County" 20040331 0 2004 3
"MARYLAND" "Howard County" 20030331 0 2003 3
"LOUISIANA" "Iberia Parish" 20080331 1 2008 3
"LOUISIANA" "Tangipahoa Parish" 20080331 1 2008 3
"FLORIDA" "Palm Beach County" 20040331 1 2004 3
"FLORIDA" "Highlands County" 20040331 1 2004 3
"FLORIDA" "Walton County" 19980331 1 1998 3
"NORTH CAROLINA" "Stanly County" 19990331 1 1999 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"FLORIDA" "Hendry County" 20040331 1 2004 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"NORTH CAROLINA" "Pitt County" 20110331 1 2011 3
"LOUISIANA" "Tangipahoa Parish" 19980331 1 1998 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"VIRGINIA" "Nottoway County" 20030331 1 2003 3
"LOUISIANA" "Concordia Parish" 20080331 1 2008 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"LOUISIANA" "Acadia Parish" 20080331 1 2008 3
"NORTH CAROLINA" "Beaufort County" 19960331 1 1996 3
"NORTH CAROLINA" "Wilson County" 19960331 1 1996 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"LOUISIANA" "West Baton Rouge Parish" 20080331 1 2008 3
"NORTH CAROLINA" "Pitt County" 19960331 1 1996 3
"NORTH CAROLINA" "Moore County" 19960331 1 1996 3
"TEXAS" "Montgomery County" 20080331 1 2008 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"NORTH CAROLINA" "Johnston County" 19960331 1 1996 3
"TEXAS" "Brazoria County" 19980331 1 1998 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"NORTH CAROLINA" "Lenoir County" 19960331 1 1996 3
"NORTH CAROLINA" "Nash County" 19960331 1 1996 3
"LOUISIANA" "Acadia Parish" 20080331 1 2008 3
"LOUISIANA" "Tangipahoa Parish" 20080331 1 2008 3
"MISSISSIPPI" "Hinds County" 20050331 1 2005 3
"FLORIDA" "Volusia County" 20040331 1 2004 3
"LOUISIANA" "Iberia Parish" 20080331 1 2008 3
"FLORIDA" "Palm Beach County" 20040331 1 2004 3
"NORTH CAROLINA" "Lenoir County" 20110331 1 2011 3
"NORTH CAROLINA" "Wilson County" 19990331 1 1999 3
"NORTH CAROLINA" "Halifax County" 19990331 1 1999 3
"MISSISSIPPI" "Tangipahoa Parish" 20080331 1 2008 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"ALABAMA" "Covington County" 20040331 1 2004 3
"FLORIDA" "Jackson County" 20040331 1 2004 3
"LOUISIANA" "Ascension Parish" 20080331 1 2008 3
"VIRGINIA" "Northampton County" 20030331 1 2003 3
"FLORIDA" "Broward County" 20040331 1 2004 3
"FLORIDA" "DeSoto County" 20040331 1 2004 3
"LOUISIANA" "Rapides Parish" 20080331 1 2008 3
"LOUISIANA" "Lafourche Parish" 20080331 1 2008 3
"NORTH CAROLINA" "Wilson County" 19990331 1 1999 3
"FLORIDA" "Hillsborough County" 20040331 1 2004 3
"NORTH CAROLINA" "Wilson County" 19990331 1 1999 3
"NORTH CAROLINA" "Cumberland County" 19960331 1 1996 3
end
Any help is much appreciated!
Related Posts with Generate a time dummy pre - and post -treatment in panel data
Ask help for xttobit model with fixed effect.Stata cannot execute fixed effect panel tobit model of course, but what if I doubt the result of ran…
Multiple Regression Issues - Stata not showing any informationHi! I am trying to do a multiple regression but when I try to do it, I don't get any of the p-values…
Having time-specific control and IV variablesHello everyone, I am currently working on a data set that has both a year variable along with pertin…
Transform time series into panel dataDear Statalist experts, I have the following time series of the US population by city and state in 2…
drop observations in long panel data set if variable changes over time, ignoring missing valuesI am working with data where certain time-invariant variables, e.g. sex and birth year, are changing…
Subscribe to:
Post Comments (Atom)
0 Response to Generate a time dummy pre - and post -treatment in panel data
Post a Comment