Hi all,
My question is about a panel data set for which in would like to regress a certain monthly score on holding period returns of equities. I'm getting to know Stata step by step and have done some reshaping and cleaning already but I cant seem to find the right way to handle this last part. Im dealing with 4 different monthly scores (0-100) and monthly holding period returns for 1000 equities in a time frame of 10 years.
The problem is the structure of the current dataset has a separate time variable for each combination of date - firm - 1/4 scores, which causes 4 identical date observations per company & return combination. I would like to ask for a way to delete the 'missing values' and combine the 4 score variables with 1 date variable row per firm.
The data currently looks like this:
Date TICKER CUSIP PERMNO RET combined environment social governance
2019m10 A 00846U10 87432 -.011483718 . . . 84.38
2019m10 A 00846U10 87432 -.011483718 79.34
2019m10 A 00846U10 87432 -.011483718 . . 94.51 .
2019m10 A 00846U10 87432 -.011483718 88.32
2019m11 A 00846U10 87432 .066270582 . 79.96 . .
2019m11 A 00846U10 87432 .066270582 83.22
2019m11 A 00846U10 87432 .066270582 87.58 .
2019m11 A 00846U10 87432 .066270582 93.6 .
2019m12 A 00846U10 87432 .058437552 83.22
2019m12 A 00846U10 87432 .058437552 79.96
2019m12 A 00846U10 87432 .058437552 87.58
2019m12 A 00846U10 87432 .058437552 93.6
2017m1 AAIC 04135620 85653 .010121496 15.75
2017m1 AAIC 04135620 85653 .010121496 0
2017m1 AAIC 04135620 85653 .010121496 25.17
2017m1 AAIC 04135620 85653 .010121496 10.18
2017m2 AAIC 04135620 85653 -.015364095 10.18
2017m2 AAIC 04135620 85653 -.015364095 25.17
2017m2 AAIC 04135620 85653 -.015364095 15.75
2017m2 AAIC 04135620 85653 -.015364095 0
2017m3 AAIC 04135620 85653 .001017662 25.17
2017m3 AAIC 04135620 85653 .001017662 15.75
2017m3 AAIC 04135620 85653 .001017662 10.18
2017m3 AAIC 04135620 85653 .001017662 0
2017m4 AAIC 04135620 85653 .030431727 15.75
I think it might be important to mention that the data is not complete for all dates or scores for some firms, also the order of the (non-missing) scores is not consistent.
Appreciate any help or tips, thank you very much in advance.
Related Posts with repeated time values within panel: combining rows with the same date
Generating a date sheet/calendar in StataHi I have to generate a date sheet/calendar (week wise preferably) which looks at the application o…
Age/sex/education match 3 groups (Apoe4 Homozygote, Apoe4 Heterozygote, non carriers)Hi there, I'd like to age/sex/education match 3 groups (genetic status: Apoe4 Homozygote, Apoe4 het…
Excel File too big to be imported to StataHi everyone, My datafile in excel is greater than 40 MB (77 MB indeed) and hence, I am not able to …
Options not allowedHi all. Here is an excerpt of a program that I am constructing for university simulate beta_1=r(m…
Reshape : , not allowedHi everyone! I have results of interviews (one person interviewed in each household). There is info…
Subscribe to:
Post Comments (Atom)
0 Response to repeated time values within panel: combining rows with the same date
Post a Comment