Dear all
I want to make a moderating variable called M&A active and give firms (identified by variable gvkey) a 0 in fyears (variable of fiscal year ) before acquisition or in every year between 1997-2015 if they never had an M&A. And a 1 in year from M&A and years AFTER FIRST M&A. Now, firms that never had an M&A already have a 0 in variable maactive but the firms that had an m&a only got a 1 in the years of the ma and not in the years after or in-between them. In the screenshot below you can see an example of ABBOT LABORATORIES.
I tried the following code: by gvkey (fyear), sort: replace maactive = maactive [_n-1] if maactive = 1
because I thought that it would give firms based on gvkey a 1 in the variable maactive if the previous observation of their gvkey is a 1. But I did not work out. I received error code r(101) weights not allowed. Could someone help me with this?
Array
Related Posts with Numbering a variable based on previous observation
Average Partial Effects (APE) after Dynamic Probit Model ala (Wooldridge, 2005)I am trying to calculate the average partial effects of the state dependence and some other covariat…
Problems with Nesting in Panel Regression "panels are not nested within clusters"Hi, I am not sure how to overcome this error message I am receiving "panels are not nested within c…
BysortHello, I have reproduced a simple replica of a bigger problem. I have data which looks as attached…
Analysis for two continuous variables (not normally distributed)Dear Statlist, I have two continuous variables, the dependent variable is not normally distributed …
Struggling with Collinearity in Panel DataHi, I am struggling with how to set up my regression robustness check. I am currently running a reg…
Subscribe to:
Post Comments (Atom)
0 Response to Numbering a variable based on previous observation
Post a Comment