Hello! This is my first post and very much in need of help with a project I've been working on for some time. I have a panel dataset for CEO campaign contributions, some company info, how much they donated to democrats in the 6 months prior to an election (midterm 2002 election), then _2002_ variable is the six month average stock price. Here is the dataex output, with the post variable corresponding to one of the two instances for each company for the 6 months pre/post the election date. I am trying to answer the question of how much an individual CEO donates to a campaign affects their stock price after an election - and for my regression I need a change variable for pre/post for _2002_, but have run into error when I run "by companyid: gen changestockprice = (_2002_ if post == 2) - (_2002 if post== 1)"
Any help would be greatly appreciated !!! Thank you!!
dataex:
input str43 corpname str8 ticker float(companyid totaldem) double _2002_ byte post
"Apple Inc" "AAPL" 1 2300 57.79999923706055 1
"Apple Inc" "AAPL" 1 2300 51.54999923706055 2
"Amerisourcebergen Corp" "ABC" 2 3667 54.5099983215332 1
"Amerisourcebergen Corp" "ABC" 2 3667 48.90000152587891 2
"Abbott Laboratories" "ABT" 3 15450 50.2599983215332 1
"Abbott Laboratories" "ABT" 3 15450 43.65000152587891 2
"Archer-Daniels-Midland Co" "ADM" 4 2000 53.54999923706055 1
"Archer-Daniels-Midland Co" "ADM" 4 2000 49.7400016784668 2
"Automatic Data Processing" "ADP" 5 700 51.54999923706055 1
"Automatic Data Processing" "ADP" 5 700 59.47999954223633 2
"Ameren" "AEE" 6 11450 53.23714229038784 1
"Ameren" "AEE" 6 11450 48.370000566755024 2
"American Electric Power Co Inc" "AEP" 7 28820 53.23714229038784 1
"American Electric Power Co Inc" "AEP" 7 28820 15.5 2
dataex (picture screengrab):
Array
Related Posts with Panel Data Help! Creating a Change Variabel
How to merge different Excel File.Hello Sir, I have 4 separate -excel files required to merge in one excel file. This is the longitud…
How to save the "drift" parameter of a Dickey-Fuller unit-root test (dfuller)?I would like to save the "drift" parameter of a Dickey-Fuller unit-root test, in order to export it …
Autocorrelation (ac and pac)I'm using the autocorrelation command ac and the partial autocorrelation command pac. I'm running th…
xtabond2: two way clustering-dynamic panelHello all. For my master thesis I am trying analyse what are the determinants of Non Performing Loan…
Understanding Abadie, Athey, Imbens, and Wooldridge (2017) using a long-difference exampleThere are 100 counties j. There are many people in each county. People do not move across counties f…
Subscribe to:
Post Comments (Atom)
0 Response to Panel Data Help! Creating a Change Variabel
Post a Comment