Hi all,

I am very new to Stata, and this my first post on Statalist.

I am using Stata 14.2 on a Windows 10.

My dataset is a survey panel data of country, firm and year. It runs from 2006 to 2020, but countries do not have surveys (by firm) in all of the years.
Firms in countries are surveyed at an irregular pattern of years. Also, the firms are not the same in a country across years.
I want to generate a dummy variable=1 if a country has two years of data. In the dataex output below, for example, I want to generate a variable for countries with two waves like Ghana, Niger and Mali.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7 country float year
"Ghana"   2006
"Ghana"   2010
"Gambia"  2007
"Gambia"  2012
"Gambia"  2019
"Nigeria" 2020
"Niger"   2008
"Niger"   2015
"Mali"    2016
"Mali"    2019
end