Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generating a dummy variable for a panel data where countries have different survey waves

    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

  • #2
    Ijeoma:
    as per FAQ, you're kindly requested to (re)post yiur query on the general forum, as this one is for practising purposes only. Thanks.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Thank you very much, Carlo, I was indeed practicing at the time. I will post in the general forum accordingly when I have further issues, as I was able to resolve this.

      Comment

      Working...
      X