Dear all, I have been struggling with the following issue. My dataset is basically like in the table. As you can see, some names are basically duplicates. My goal would be to merge these rows with the same name into on that has values for the for variables. For float variables (Var1 and Var2), I basically use the following code: bysort Name : replace Var1 = sum(Var1). This works perfectly. However, for string variables, I am struggling. Would you have any idea?
Thanks a lot,
Pierre
The dataset is like this:
Name |
Var1 |
Var2 |
Var3 |
Var4 |
Patrick |
4 |
. |
TRUE |
. |
Joseph |
8 |
. |
TRUE |
. |
Andrew |
1 |
. |
NO |
. |
Andrew |
. |
4 |
. |
NO |
Joseph |
. |
7 |
. |
TRUE |
And I want it like this:
Name |
Var1 |
Var2 |
Var3 |
Var4 |
Patrick |
4 |
. |
TRUE |
. |
Joseph |
8 |
7 |
TRUE |
TRUE |
Andrew |
1 |
4 |
NO |
NO |
0 Response to Merging rows that have identical names
Post a Comment