Hi,
My datasets are like following forms:
Inventorid patentyear firmid
3930988 2000 13928
3930988 2001 13928
3930988 2002 15892
3890212 2001 15892
3890212 2001 15892
I'm trying to compare firmid for the same inventor and generate a variable move = 1 if firmid != firmid in the previous rows. The desired results is as follows. For example, for inventor 3930988, he is regarded as move = 1 when the firmid change (15892 VS 13928).
NOTE that, comparison of the firms only within observations. For example, for inventor 3930988, compare firmid within the first 3 rows. for Inventor 3890212, compare within the last two rows. Many thanks if you could provide any suggestions!
Inventorid patentyear firmid move
3930988 2000 13928 0
3930988 2001 13928 0
3930988 2002 15892 1
3890212 2001 15892 0
3890212 2001 15892 0
Related Posts with Compare values across rows within observation
Interpretation and finding the long run relationship in vector error correction model for 4 variables and 2 cointegration vectorsI tried to do cointegration test for 4 variables (y, x, z, w) using vecrank command and found that t…
Using fiscal year(t-1) values rather than calendar year(t-1) valuesDear Statalist Community, I'm currently analysing abnormal returns using company financials. In com…
QuantilesGood morning I have created new quantile variables for my data using xtile variable_4 = variable, n…
Running a Tobit with panel dataHey all! As a part of my Master's thesis, I am conducting an analysis of underreporting of migratio…
Stacked barchart displaying proportion of each category over different yearsHello everyone, I have managed to create the stacked barchart I want, but in order to do so, I had t…
Subscribe to:
Post Comments (Atom)
0 Response to Compare values across rows within observation
Post a Comment