Announcement

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

  • Constructing summary statistics for each country in panel data

    Hi Statalist,

    In my data set I've information of 150 countries over a period of 25 years. The variables, Price, Production, Agriculture, Industry and Service are the most important ones and I want to show them in a clear table. I want to construct a table in which each line shows to average value of the variables for each country over the entire periode. I was able to construct these average variables but I'm not able to represent them in a clear table. hopefully somebody could help me.

    Hopefully I used dataex in the correct manner.

    input str30 Country int Year float(AverageProductionCountry AveragePriceCountry AverageService AverageIndustry AverageArgiculture)
    "afghanistan" 2002 . . 22.604847 5.899807 71.49531
    "afghanistan" 2003 . . 22.604847 5.899807 71.49531
    "afghanistan" 1996 . . 22.604847 5.899807 71.49531
    "afghanistan" 2004 . . 22.604847 5.899807 71.49531
    "afghanistan" 1994 . . 22.604847 5.899807 71.49531
    "afghanistan" 2012 . . 22.604847 5.899807 71.49531
    "afghanistan" 1993 . . 22.604847 5.899807 71.49531
    "afghanistan" 2000 . . 22.604847 5.899807 71.49531
    "afghanistan" 2010 . . 22.604847 5.899807 71.49531
    "afghanistan" 1997 . . 22.604847 5.899807 71.49531
    "afghanistan" 2014 . . 22.604847 5.899807 71.49531
    "afghanistan" 2006 . . 22.604847 5.899807 71.49531
    "afghanistan" 2007 . . 22.604847 5.899807 71.49531
    "afghanistan" 2001 . . 22.604847 5.899807 71.49531
    "afghanistan" 1998 . . 22.604847 5.899807 71.49531
    "afghanistan" 2011 . . 22.604847 5.899807 71.49531
    "afghanistan" 1999 . . 22.604847 5.899807 71.49531
    "afghanistan" 2013 . . 22.604847 5.899807 71.49531
    "afghanistan" 1995 . . 22.604847 5.899807 71.49531
    "afghanistan" 2009 . . 22.604847 5.899807 71.49531
    "afghanistan" 2008 . . 22.604847 5.899807 71.49531
    "afghanistan" 2015 . . 22.604847 5.899807 71.49531
    "afghanistan" 1992 . . 22.604847 5.899807 71.49531
    "afghanistan" 2016 . . 22.604847 5.899807 71.49531
    "afghanistan" 2005 . . 22.604847 5.899807 71.49531
    "afghanistan" 1991 . . 22.604847 5.899807 71.49531
    "albania" 2013 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2011 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2009 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1991 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2014 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2008 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1996 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2010 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1992 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1999 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2015 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2012 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1993 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2003 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2004 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2000 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2005 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2002 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2016 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1998 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2006 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 2001 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1995 622.9832 48.18548 26.59523 17.326077 56.07862
    "albania" 1994 622.9832 48.18548 26.59523 17.326077 56.07862
    end
    format %ty Year
    [/CODE]


    Best,Thomas

  • #2
    Code:
    help tabdisp
    
    tabdisp Country, c(Average*) format(%2.1f)
    Almost there on dataex: you need opening and closing CODE delimiters.

    Note: You should probably rename the cell variables to something shorter.
    Last edited by Nick Cox; 18 Jun 2018, 05:01.

    Comment


    • #3
      Thanks a lot!

      Comment

      Working...
      X