Hi
I have a paneldataset which contains 1549 unique isin numbers (identification number) with each of them having 13 observations for the years 2005 - 2017.
However, I have a list of only 1,399 of these identifiers that I need and I want to drop the rest of them.
Is there any easy way I can do this?
I have tried merging without luck using the following approach:
sort masterfile based on isin (the unique identifier)
--- this creates content like:
id
1
1
1
1
2
2
2
2
I have then created a second file called "identifier" containing the 1,399 identifiers that I want. I have sorted them as well:
id copy
1 1
2 2
3 3
4 4
I then merged from the masterfile hoping that it would create a new variable called "copy" matching the id from both files:
merge id using identifier
id copy
1 1
1 1
1 1
1 1
2 2
2 2
2 2
2 2
Because there will be no match for the 150 uniquely identifiers, the "copy" variable would have missing values here. Thus, my idea was to just drop if missing(copy).
However, what is returned is one big mess.
Any help please?
Best regards, Morten
I have a paneldataset which contains 1549 unique isin numbers (identification number) with each of them having 13 observations for the years 2005 - 2017.
However, I have a list of only 1,399 of these identifiers that I need and I want to drop the rest of them.
Is there any easy way I can do this?
I have tried merging without luck using the following approach:
sort masterfile based on isin (the unique identifier)
--- this creates content like:
id
1
1
1
1
2
2
2
2
I have then created a second file called "identifier" containing the 1,399 identifiers that I want. I have sorted them as well:
id copy
1 1
2 2
3 3
4 4
I then merged from the masterfile hoping that it would create a new variable called "copy" matching the id from both files:
merge id using identifier
id copy
1 1
1 1
1 1
1 1
2 2
2 2
2 2
2 2
Because there will be no match for the 150 uniquely identifiers, the "copy" variable would have missing values here. Thus, my idea was to just drop if missing(copy).
However, what is returned is one big mess.
Any help please?
Best regards, Morten
Comment