Announcement

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

  • questions about the command "tab" and "putexcel" for panel data

    Hello everyone,
    I am Quan. My dataset is the export value of a country (divided into 6 digit code HS ) to all countries and ranges from 1995-2021.
    Now I want to know how the export value has changed for the top 20 importers. Therefore I used the command "bysort year importer: egen exportall=sum(export)"

    and I have checked the result with the command " tab importer if year==1995, su(exportall) nost" or "groups importer exportall if year==1995, order(high) select (20) sep(10)" ,
    but I applied this command to all years, and when I copy the result to Excel, the importer names could cause an error due to spaces in the country name and different ranks in the different export years.


    So my question is if there is a command that outputs the result in STATA as follows: ( if it's not possible, then is there there any better way to output result to the excel without any matches?) Thanks!
    exports value 1995 1996 1997 1998 1999 2000 2001
    All Sum All Sum All Sum All Sum All Sum All Sum All Sum
    country1
    country2
    country3
    country4
    country5
    country6
    country7
    country8
    country9
Working...
X