Announcement

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

  • Populating a column with values

    I need to populate the empty columns with corresponding values within that year, it could be that I have to repeat the entry of the values (for instance fill up 2004 with the same values-128, 2005-130, 2006-130, 2007-127). Any suggestions of the right code to use? This is just an example, I have observations of over 6 million: 24 countries,
    year country GDP
    2004 SE 128
    2004 SE
    2004 SE
    2005 SE 131
    2005 SE
    2005 SE
    2006 SE 130
    2006 SE
    2006 SE
    2007 SE 127
    2007 SE
    2007 SE

  • #2
    Your question is more appropriately posted in the General Forum. This forum is for questions relating to Stata's matrix programming language.

    Code:
    bys country year (GDP): replace GDP=GDP[1]

    Comment


    • #3
      Hi Andrew,
      I tried to apply the command but I did not succeed. Let me explain further. I already have a micro data for the EU countries with individuals nested in households and households nested in countries. I need to add macro variables to the main dataset. The only challenge here is that macro-variables observations do not match what I have on the main data. I need to fill the spaces with the same values per country per year, with an assumption that GDP annual values stays the same. Kindly help out with that.

      Comment


      • #4
        Start a new thread in the General Forum, copying and pasting the result of

        Code:
        sort country year
        dataex

        Comment


        • #5
          It worked. I was doing it wrongly. Thanks

          Comment

          Working...
          X