Announcement

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

  • URGENT! No observations after merging/Appending Data sets

    Hello,

    I am relatively new to Stata as well as the Statalist forum so if I do explain anything incorrectly I do apologise in advance.

    My aim is to regress the following variables (Ease of doing business, CorruptionEst, Polstabilityest, Goveffectivenessest, and regqualityest ) upon GDPpercapitaconstant20210us to measure the effects these variables have on economic growth.

    After merging the data sets I try a simple linear regression however the error code (r2000) appears with the comment no observations. I know that the issue is stemmed from the merging, however, i have tried everything i.e. reading the forum, and watching any possible videos.

    Any help would be great.
    Thank you,
    Joshua

    WDI_Growth_Data(1).dta
    World_Bank_Governance_Indicators(1).dta

  • #2
    Welcome to Statalist!

    The problem is that there no observations in your dataset for which all of the variables included in your regression are non-missing at the same time.

    This may have been caused by inappropriate use of the merge command, or, more likely, it may just be an unfortunate fact of the data which you will need to address in order to conduct your analysis (e.g. finding alternative sources of data to fill the missing observations; using some other method of interpolation; omitting problematic variables from the regression; etc.).

    Since you do not provide a sample of the code you used to merge the datasets and run the regression, or a useable data example (using the -dataex- command rather than attaching the datasets, as advised in the FAQ section of this forum), it is difficult to provide more specific advice.
    Last edited by Ali Atia; 15 Mar 2022, 12:01.

    Comment


    • #3
      Hello Ali,

      Thank you for an early and convenient reply.

      The code i have used is as follows: merge 1:1 cyr using "/Users/joshua/Desktop/Year 3 S2/ECON 3038 /STATA/World_Bank_Governance_Indicators(1) (3).dta"

      This then resulted in me trying to drop observations for a more balanced dataset represented by the results below

      Result # of obs.
      -----------------------------------------
      not matched 3,824
      from master 231 (_merge==1)
      from using 3,593 (_merge==2)

      matched 901 (_merge==3)
      -----------------------------------------

      . drop if (_merge==1)
      (231 observations deleted)

      . drop if (_merge==2)
      (3,593 observations deleted)

      I apologise that this is all over the place however a lot of the code I have used is trial and error.

      Describing the dataset after the merge:

      Contains data from /Users/joshua/Desktop/Year 3 S2/ECON 3038 /STATA/WDI_Growth_Data(1).dta
      obs: 901
      vars: 40 8 Mar 2021 11:43
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      storage display value
      variable name type format label variable label
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      country str52 %52s country
      code str3 %9s code
      cyr str7 %9s cyr
      year int %10.0g year
      GDPconstant20~S double %10.0g GDP (constant 2010 US$)
      GDPgrowthannual double %10.0g GDP growth (annual %)
      GDPpercapitac~S double %10.0g GDP per capita (constant 2010 US$)
      Expenditureon~i double %10.0g Expenditure on secondary education (% of government expenditure on education)
      Expenditureon~n double %10.0g Expenditure on primary education (% of government expenditure on education)
      Expenditureon~o double %10.0g Expenditure on tertiary education (% of government expenditure on education)
      Educationalat~t double %10.0g Educational attainment, at least completed lower secondary, population 25+, tota
      L double %10.0g Educational attainment, at least completed post-secondary, population 25+, total
      M double %10.0g Educational attainment, at least completed primary, population 25+ years, total
      Governmentexp~t double %10.0g Government expenditure on education, total (% of GDP)
      O double %10.0g Educational attainment, at least completed upper secondary, population 25+, tota
      Costofbusines~d double %10.0g Cost of business start-up procedures (% of GNI per capita)
      Easeofdoingbu~0 double %10.0g Ease of doing business score (0 = lowest performance to 100 = best performance)
      Timerequiredt~s double %10.0g Time required to start a business (days)
      Startupproced~r double %10.0g Start-up procedures to register a business (number)
      GDPpercapitag~l double %10.0g GDP per capita growth (annual %)
      GDPPPPcurrent~l double %10.0g GDP, PPP (current international $)
      GDPpercapitaP~t double %10.0g GDP per capita, PPP (current international $)
      Grosscapitalf~D double %10.0g Gross capital formation (% of GDP)
      Humancapitali~e double %10.0g Human capital index (HCI) (scale 0-1)
      Grossfixedcap~a double %10.0g Gross fixed capital formation (annual % growth)
      Grosssavingso~P double %10.0g Gross savings (% of GDP)
      Grossdomestic~P double %10.0g Gross domestic savings (% of GDP)
      CorruptionEst double %10.0g Control of Corruption: Estimate
      CorruptionPerc double %10.0g Control of Corruption: Percentile Rank
      GovEffectiven~t double %10.0g Government Effectiveness: Estimate
      GovEffectiven~c double %10.0g Government Effectiveness: Percentile Rank
      PolStabilityEst double %10.0g Political Stability and Absence of Violence/Terrorism: Estimate
      RegQualityEst double %10.0g Regulatory Quality: Estimate
      RegQualityPerc double %10.0g Regulatory Quality: Percentile Rank
      RuleofLawEst double %10.0g Rule of Law: Estimate
      RuleofLawPerc double %10.0g Rule of Law: Percentile Rank
      VoiceAccEst double %10.0g Voice and Accountability: Estimate
      VoiceAccPerc double %10.0g Voice and Accountability: Percentile Rank
      PolStabilityP~c double %10.0g Political Stability and Absence of Violence/Terrorism: Percentile Rank
      _merge byte %23.0g _merge

      Comment


      • #4
        Unfortunately, I have to agree with Ali Atia.

        Your datasets are too big to post here, but all that can be said without looking at them is that the merge didn't do what you wanted.

        r(2000) means one of two things. Either you have string variables that should be numeric, but here

        country str52 %52s country
        code str3 %9s code
        cyr str7 %9s cyr

        are just things than can reasonably be string and they don't (won't) feature in the regression you intend. Or you have missing values, which is the problem.

        By the way, we do flag briefly in the FAQ Advice that urgency is your concern, not ours. People are willing to answer good precise questions, regardless.

        Comment

        Working...
        X