I am working with two variables: year and country. How can I obtain total number of distinct countries and total country frequency by year?
I tried
The code gives total country frequency, but does not provide total number of distinct countries. Is there any way I can obtain the desired output i.e. total number of distinct countries and total frequencies in one table? Thanks.
I tried
Code:
by year, sort: tab country
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float year str38 country 2007 "Australia" 2007 "Australia" 2007 "Australia" 2007 "Australia" 2007 "Australia" 2007 "Australia" 2007 "Brazil" 2007 "Brazil" 2007 "Brazil" 2007 "Canada" 2007 "Canada" 2007 "Canada" 2007 "Canada" 2007 "Canada" 2007 "China" 2007 "China" 2007 "China" 2007 "Estonia" 2007 "France" 2007 "France" 2007 "Germany" 2007 "Germany" 2007 "Guernsey" 2007 "Hong Kong" 2007 "Hong Kong" 2007 "India" 2007 "India" 2007 "Isle of Man" 2007 "Israel" 2007 "Italy" 2007 "Japan" 2007 "Japan" 2007 "Japan" 2007 "Japan" 2007 "Malaysia" 2007 "Mexico" 2007 "Poland" 2007 "Poland" 2007 "Russian Federation" 2007 "Russian Federation" 2007 "Russian Federation" 2007 "Saudi Arabia" 2007 "South Korea" 2007 "United States of America" 2007 "United States of America" 2007 "United States of America" 2007 "United States of America" 2007 "Vietnam" 2017 "Australia" 2017 "Chile" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "China" 2017 "Egypt" 2017 "Hong Kong" 2017 "Hong Kong" 2017 "Hong Kong" 2017 "Hong Kong" 2017 "India" 2017 "India" 2017 "India" 2017 "India" 2017 "India" 2017 "India" 2017 "India" 2017 "India" 2017 "Indonesia" 2017 "Indonesia" 2017 "Israel" 2017 "Israel" 2017 "Italy" 2017 "Japan" 2017 "Japan" 2017 "Japan" 2017 "Japan" 2017 "Malaysia" 2017 "Malaysia" 2017 "Philippines" 2017 "Singapore" 2017 "Singapore" 2017 "South Korea" 2017 "South Korea" 2017 "United Kingdom" 2017 "United Kingdom" 2017 "United Kingdom" 2017 "United Kingdom" 2017 "United States of America" 2017 "United States of America" 2017 "United States of America" 2017 "Vietnam" end
Comment