Hi there,
I am looking for a code that combine the rows when end_date = start_date for a certain ID when all the variables have same values. For example, in the table below, ID 1 has 4 rows and their variables x and y have the same values in each rows under ID 1. ID 1 has end_date=start_date in each of its row. In that case, ID 1 will be combined into one row that will show the very first start_date and very last end_date.
id start_date end_date x y
1 10 12 10 12
1 12 14 10 12
1 14 16 10 12
1 16 21 10 12
2 11 13 15 17
2 13 15 15 17
3 16 18 20 22
3 18 20 20 22
3 20 25 20 22
Result will look like this:
id start_date end_date x y
1 10 21 10 12
2 11 15 15 17
3 16 25 20 22
I am seeking for help to get the code.
Thank you.
Kind regards,
Rakib
Related Posts with Combine multiple rows into one when end_date = start_date
Hedge fund data set for statahow can I create a distinct variable and using that variable to entire data set, example Fund 1--200…
OLS model that includes related covariates that add up to 100%Hi group, I'm running an OLS model where the dependent variable is patients' average value of HgA1c,…
loop over the panel IDs to use quantile regressions xtqregHi, I am running quantile regression for panel of 260 firms for period of 15 years. The general reg…
Help with outputting Mixed command results to ExcelHello, I hope you could help me, I have spent days trying to figure this out. I am trying to output…
Ideas on how to convert a hyphenated interval (e.g. '5-8') into its constituent integers delimited by commas (e.g. '5,6,7,8')?Hi, As my post title states, I have data with varied hyphenated intervals such as '3-6', '1-5', '10-…
Subscribe to:
Post Comments (Atom)
0 Response to Combine multiple rows into one when end_date = start_date
Post a Comment