Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: tabstat if, by() stat(sum) Query


From   Muhammad Anees <[email protected]>
To   [email protected]
Subject   st: tabstat if, by() stat(sum) Query
Date   Thu, 22 Nov 2012 12:08:25 +0500

Dear All,

I am using Stata 12 and working on producing summary statistics for a
given dataset. My confusion arises when I use the subject command to
calculate sum of the given variables for country2 across the list of
country1 for a given year. I have only two years data, 1990 and 2000.

On Stata, I am using this:

tabstat total primary secondary tertiary if year==1990, by(ctry2) stat(sum)

and similarly when I do the same to manually calculate the sum using
MS Excel, I do get very different results. Is there a way to confirm
why -tabstat- produces difference results for any year for a given
country (ctry2) across countries on ctry1.

The example from dataset I am using is given below.

year	ctry1	ctry2	total	primary	secondary	tertiary
1990	Australia	Afghanistan	1,560	318	124	1,118
1990	Austria	Afghanistan	0	0	0	0
1990	Belgium	Afghanistan	91	1	7	19
1990	Canada	Afghanistan	3,125	890	470	1,765
1990	Denmark	Afghanistan	149	24	31	26
1990	Ex-Czechoslovakia	Afghanistan	91	54	13	14
1990	Finland	Afghanistan	5	3	0	2
1990	Australia	Albania	879	533	168	178
1990	Austria	Albania	512	273	196	43
1990	Belgium	Albania	425	49	34	20
1990	Canada	Albania	370	215	60	95
1990	Denmark	Albania	1	0	0	0
1990	Ex-Czechoslovakia	Albania	57	34	8	9
1990	Finland	Albania	13	5	4	4
...
...
...
...

2000	Australia	Afghanistan	6,641	2,281	632	3,728
2000	Austria	Afghanistan	1,270	816	216	238
2000	Belgium	Afghanistan	0	0	0	0
2000	Canada	Afghanistan	13,095	4,285	2,035	6,775
2000	Czech Republic	Afghanistan	165	9	67	86
2000	Denmark	Afghanistan	1,404	217	323	357
2000	Finland	Afghanistan	164	99	29	36
2000	Australia	Albania	1,179	540	198	441
2000	Austria	Albania	1,246	368	540	338
2000	Belgium	Albania	0	0	0	0
2000	Canada	Albania	3,540	435	520	2,585
2000	Czech Republic	Albania	137	8	64	64
2000	Denmark	Albania	52	11	13	17
2000	Finland	Albania	26	10	9	7
...
...
...
...


-- 

Best
---------------------------
Muhammad Anees
Assistant Professor/Programme Coordinator
COMSATS Institute of Information Technology
Attock 43600, Pakistan
http://www.aneconomist.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index