Dear Stata users,

I am using Stata 17.

Based on two variables
Code:
date & urbanname
I have duplicates. Each duplicate (based on these variables) has values in other variables whereas the other duplicate has ".".

I would like to create one row with all the values of each duplicate (to keep all of the information of each duplicate) and drop the duplicates.

How shall I proceed?

My dataset is of the following form

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(mainid date) strL urbanname float(pm25 date_start)
25 714 "Hanoi"      9.666667 617
25 708 "Hanoi"          13.8 617
25 713 "Hanoi"     14.615385 617
25 737 "Hanoi"      20.48387 617
25 738 "Hanoi"          23.6 617
25 739 "Hanoi"      23.62963 617
25 743 "Hanoi"          25.7 617
25 720 "Hanoi"      27.16129 617
25 690 "Hanoi"      29.82143 617
25 725 "Hanoi"     30.096775 617
25 726 "Hanoi"          30.3 617
27 726 "Xiamen"         30.6 695
25 750 "Hanoi"     30.857143 617
25 731 "Hanoi"     32.366665 617
25 732 "Hanoi"     33.533333 617
25 730 "Hanoi"     38.032257 617
25 697 "Hanoi"          38.7 617
25 727 "Hanoi"            39 617
27 750 "Xiamen"     40.30435 695
25 740 "Hanoi"      40.64516 617
27 725 "Xiamen"     40.74194 695
40 720 "Hyderabad"  40.85185 694
40 725 "Hyderabad"        41 694
25 721 "Hanoi"      41.13334 617
25 689 "Hanoi"         41.36 617
27 738 "Xiamen"         43.4 695
25 733 "Hanoi"      44.55172 617
25 694 "Hanoi"      44.56522 617
34 737 "Guiyang"    45.06452 695
27 737 "Xiamen"     45.29032 695
35 750 "Dongguan"   46.43478 676
27 742 "Xiamen"     46.45161 695
27 720 "Xiamen"     46.51613 695
36 737 "Changzhou"  46.54839 716
25 693 "Hanoi"            47 617
34 743 "Guiyang"        47.1 695
43 737 "Hohhot"     47.55914 719
27 732 "Xiamen"     47.66667 695
25 742 "Hanoi"      47.83871 617
25 679 "Hanoi"         47.92 617
27 747 "Xiamen"     47.96429 695
29 720 "Urumqi"     48.16129 705
43 708 "Hohhot"     48.82796 719
42 722 "Jarkarta"   49.06452 711
40 726 "Hyderabad"  49.33333 694
27 743 "Xiamen"     49.46667 695
40 737 "Hyderabad"  49.90322 694
27 739 "Xiamen"     50.16129 695
25 676 "Hanoi"         50.25 617
42 700 "Jarkarta"   50.62827 711
25 745 "Hanoi"          50.7 617
25 735 "Hanoi"      51.07143 617
42 686 "Jarkarta"       51.1 711
29 750 "Urumqi"     51.30435 705
29 738 "Urumqi"     51.53333 705
29 725 "Urumqi"      51.6129 705
25 751 "Hanoi"      51.76923 617
35 725 "Dongguan"   51.87097 676
34 738 "Guiyang"          52 695
25 695 "Hanoi"      52.05556 617
25 729 "Hanoi"      52.53333 617
35 726 "Dongguan"   52.56667 676
43 720 "Hohhot"     52.75269 719
43 731 "Hohhot"     52.82222 719
43 750 "Hohhot"     52.86956 719
39 732 "Fuzhou"     53.04762 676
29 737 "Urumqi"     53.25806 705
43 738 "Hohhot"     53.83333 719
43 751 "Hohhot"     53.90322 719
40 743 "Hyderabad"      54.1 694
34 732 "Guiyang"    54.52381 695
27 751 "Xiamen"     54.67742 695
39 742 "Fuzhou"     54.80645 676
29 714 "Urumqi"     54.93333 705
27 727 "Xiamen"           55 695
33 737 "Hefei"            55 683
43 743 "Hohhot"     55.13334 719
34 750 "Guiyang"    55.21739 695
40 713 "Hyderabad"  55.35484 694
40 708 "Hyderabad"        56 694
34 742 "Guiyang"    56.06452 695
34 751 "Guiyang"    56.06452 695
43 707 "Hohhot"     56.15556 719
39 737 "Fuzhou"     56.16129 676
25 684 "Hanoi"      56.22727 617
43 672 "Hohhot"     56.25806 719
39 750 "Fuzhou"      56.3913 676
27 713 "Xiamen"     56.54839 695
40 731 "Hyderabad"  56.69231 694
27 708 "Xiamen"     56.77419 695
27 722 "Xiamen"           57 695
25 678 "Hanoi"          57.5 617
35 739 "Dongguan"   57.54839 676
25 728 "Hanoi"      57.58621 617
42 730 "Jarkarta"     58.125 711
43 714 "Hohhot"         58.4 719
27 730 "Xiamen"     58.51613 695
43 696 "Hohhot"     58.98925 719
39 743 "Fuzhou"     59.03333 676
34 739 "Guiyang"    59.19355 695
end
format %tm date
format %tm date_start
Thank you for your help!