Announcement

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

  • How to test observation in a group of countries?

    I want to test the observations in a group of countries as below

    Code:
    reghdfe y x if  inlist(GEOGN, "CHINA" "UNITEDS" "INDONESIA" "RUSSIAN" "MEXICO" "JAPAN" "PHILIPPINES" "VIETNAM" "SOUTHKOREA") | inlist(GEOGN,"COLOMBIA" "CANADA" "PERU" "MALAYSIA" "AUSTRALIA" "CHILE" "ECUADOR" "SINGAPORE" "NEWZEALAND"), a(TYPE2 INDC32#yr)
    And it returns the omitted result
    So, I did a search and see this topic (https://www.statalist.org/forums/for...ring-variables)
    And I adjusted my code to inlist of 10 countries each


    Code:
    reghdfe y x if  inlist(GEOGN, "CHINA" "UNITEDS" "INDONESIA" "RUSSIAN" "MEXICO" "JAPAN" "PHILIPPINES" "VIETNAM" "SOUTHKOREA") | inlist(GEOGN,"COLOMBIA" "CANADA" "PERU" "MALAYSIA" "AUSTRALIA" "CHILE" "ECUADOR" "SINGAPORE" "NEWZEALAND"), a(TYPE2 INDC32#yr)
    Is this a right code, is there any other way to run data for a group of countries (without cutting the data to another file)

  • #2
    Just create a dummy for the countries you want in the sample.

    Code:
    g keep = inlist(GEOGN, "CHINA" , "UNITEDS", "INDONESIA", "RUSSIAN", "MEXICO", "JAPAN", "PHILIPPINES", "VIETNAM", "SOUTHKOREA" ,"COLOMBIA", "CANADA", "PERU", "MALAYSIA", "AUSTRALIA", "CHILE", "ECUADOR", "SINGAPORE", "NEWZEALAND")
    reghdfe y x if keep

    Comment


    • #3
      Originally posted by George Ford View Post
      Just create a dummy for the countries you want in the sample.

      Code:
      g keep = inlist(GEOGN, "CHINA" , "UNITEDS", "INDONESIA", "RUSSIAN", "MEXICO", "JAPAN", "PHILIPPINES", "VIETNAM", "SOUTHKOREA" ,"COLOMBIA", "CANADA", "PERU", "MALAYSIA", "AUSTRALIA", "CHILE", "ECUADOR", "SINGAPORE", "NEWZEALAND")
      reghdfe y x if keep
      Hi George Ford , I remember the limitation of inlist is 10 items so it seems that we cannot do as you suggested

      Comment


      • #4
        You can split it up like you did in your post.

        Or

        Code:
        g keep = 0
        foreach c in CHINA UNITEDS  INDONESIA RUSSIAN MEXICO JAPAN PHILIPPINES VIETNAM SOUTHKOREA COLOMBIA CANADA PERU MALAYSIA AUSTRALIA CHILE ECUADOR SINGAPORE NEWZEALAND {
            replace keep = 1 if GEOGN=="`c'"
        }

        Comment

        Working...
        X