Hi, everyone! I've got an ill-organized raw dataset and I met some troubles while trying to clean it. 1. There are multiple rows for one person and I'd like to combine them into one. It's like ID Gender Age Var1 Var2 Var3 1 F . . 5 10 1 . 25 . . . 1 . . 6 . . And the problem is that the missing pattern is not consistent across individuals. That is, for another individual, the data may look like ID Gender Age Var1 Var2 Var3 1 F 25 6 . . 1 . . . 5 . 1 . . . . 10 So by far what I can do with it is subsetting the data into many small non-missing datasets including ID and another variable, then remerging them by ID. Since there are many variables in the dataset, it is too time-consuming. Is there any simple way or command that can combine the data into one row for one individual? 2. The other scenario is that there are partly duplicated observations, which look like ID Gender Age Var1 Var2 Var3 1 F . . 5 10 1 F 25 6 5 10 I hope to retain the observation with the most complete information and delete the duplicates. The only way I know about eliminating duplicates is using PROC SORT with NODUP options, but it seems that it does not work here. I feel that it can be solved in a similar way as for problem 1, but I don't know how. Thank you!
... View more