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
shp2dta returns zero observations in coordinates fileHello everyone, As the title indicates, the command -shp2dta- is giving me a coordinates file with …
Goodness of fit binairy logistic panel regression?Good day, I am trying to compare the goodness of fit of 6 different models (binary logistic panel re…
Value Label on statesI am trying to make a variable (state_num) for the 50 states and D.C. where Alabama ==1, Alaska ==2,…
Paired or unpaired t-testI would like to compare two samples -- one sample includes all the observations in my dataset. Anoth…
forvaluesI ran the following command forvalues state_num = 1 (1) 51 { reg edge percentFRL } Trying to run t…
Subscribe to:
Post Comments (Atom)
0 Response to Numbering a variable based on previous observation
Post a Comment