Hello, I've been trying to create the table below in Stata. It is possible to create a table like this?? I really appreciate any comments and help
Thanks in advance
Thanks in advance
* Example generated by -dataex-. To install: ssc install dataex clear input long(subgroup location) int(year value) 1 1 2002 1000 1 2 2002 200 1 1 2005 1200 1 2 2005 250 1 1 2010 1400 1 2 2010 300 1 1 2015 1600 1 2 2015 325 1 1 2020 2000 1 2 2020 350 2 1 2002 8000 2 2 2002 1000 2 1 2005 8500 2 2 2005 1200 2 1 2010 9000 2 2 2010 1500 2 1 2015 9500 2 2 2015 1700 2 1 2020 10600 2 2 2020 1850 end label values subgroup subgp_ label def subgp_ 1 "Regional", modify label def subgp_ 2 "Total", modify label values location loc_ label def loc_ 1 "Urban", modify label def loc_ 2 "Rural", modify * Display data on screen bys subgroup year (location) : egen sumvalue = sum(value) gen pc = 100*value/sumvalue table location year, c(sum value sum pc) row by(subgroup) format(%4.1f) * Export data to Excel tabout location year if subgroup==1 [fw=value] using test.xls, c(freq col) f(0 1) tabout location year if subgroup==2 [fw=value] using test.xls, c(freq col) f(0 1) append
Comment