Hi everyone,
I have a quick question. I'd like to know if the IDs of two datasets are different in a more efficient way than mine (possibly my way is wrong...):
I have two datasets with the same identifier variable name: "id".
So here are my steps:
(1) I open the first dataset and type in the command set -isid id-
(2) I don't get any error messages, so everything's fine: the id variable uniquely identifies each observation.
(3) I open dataset 2. I carry out exactly the same procedure as in (2). No error message either.
(4) To see if the two IDs are identical, I run the following command. Let's imagine that my master data is "dataset_1" and my using dataset is "dataset_2".
I get this for example:
Can I deduce from this that the two datasets have different IDs? Is there a better way of observing this than this?
I say this because I need to compare a file with other files. The other files are monthly and run from January 2021 to July 2023... So the procedure would be very energy and time-consuming
Thanks a lot.
Best,
Michael
I have a quick question. I'd like to know if the IDs of two datasets are different in a more efficient way than mine (possibly my way is wrong...):
I have two datasets with the same identifier variable name: "id".
So here are my steps:
(1) I open the first dataset and type in the command set -isid id-
(2) I don't get any error messages, so everything's fine: the id variable uniquely identifies each observation.
(3) I open dataset 2. I carry out exactly the same procedure as in (2). No error message either.
(4) To see if the two IDs are identical, I run the following command. Let's imagine that my master data is "dataset_1" and my using dataset is "dataset_2".
Code:
merge 1:1 id using dataset_2
Code:
. merge 1:1 id using dataset_2 Result Number of obs ----------------------------------------- Not matched 5,808,563 from master 2,579,289 (_merge==1) from using 3,229,274 (_merge==2) Matched 0 (_merge==3) ----------------------------------------- .
I say this because I need to compare a file with other files. The other files are monthly and run from January 2021 to July 2023... So the procedure would be very energy and time-consuming
Thanks a lot.
Best,
Michael
Comment