Hello,

I am getting strange results when I try to collapse country data and I would like to ask your help...

variables: CountryName, CountryID
observations:over 20,000

Goal: there are 115 unique countries in the data and I want to export the unique country names and their IDs.

My data looks like this:
CountryName CountryID
Albania 100
Germany 110
...etc. for 20,000 entires

My collapse code:collapse (firstnm) CountryName, by(CountryID)

Problem after this collapse code is that the "CountryID" is no longer a number...it only shows the string:
CountryName CountryID
Albania Albania
Germany Germany
...etc.
Does anyone have any suggestions on how to fix my -collapse- code? I want to be able to export this collapsed data with BOTH CountryName and CountryID.

Thank you!