question midterm 2

question midterm 2

by Christopher Johnson -
Number of replies: 1

Hello, my question is about Part2 questions 5g, 5h. I used the following 2 commands for 5g and 5h:

**5G: duplicates report id visitdate

**5H: duplicates drop

Is the command for 5H sufficient to drop the id and visitdate duplicates? My concern is that it is dropping more duplicates than just the "id" and "visitdate" duplicates. I trialed using "duplicates drop id visitdate" but I get error message r111. I'm just wondering what the correct command is.

Thanks,

Chris

In reply to Christopher Johnson

Re: question midterm 2

by Cozie Gwaikolo -
Hi Christopher,

g: this question is asking for the number of duplicates there are for “id” and “visitdate”. So yes, your command is adequate; all you need to do now is to count the number of duplicates.
h: for this question, you're being asked to drop the duplicates you found in "g" for "id" and "visitdate". The command "duplicates drop" is much broader and drops duplicates in all observations in your dataset. You may only use it if you are sure that the only duplicates in your dataset are in "id" and "visitdate", or if you intend to drop duplicates for all observations. So, I think your command "duplicates drop id visitdate" is much more specific and appropriate. Now, as part of the error message, Stata is recommending use of the "force" option. Please include the "force" option in your command and let me know how it goes.

Cozie