barchart proportion.log

5
--------------------------------------------------------- name: <unnamed> log: z:\trp\log\trp_barchart_proportion.log log type: text opened on: 19 Aug 2015, 00:00:25 . . #delimit; delimiter now ; . ********************************************************************************* Trial > Research Paper: Create Time-Series Dataset by year************************************** > *****************************************; . use z:/trp/data/trp_table1.dta, clear; . set scheme s2mono; . ** construct table; . drop if offensive == 0 & defensive == 0; (3 observations deleted) . tab year defensive, matcell(freq) matrow(names); | defensive year | 0 1| Total -----------+----------------------+---------- 1998 | 7 59 | 66 1999 | 12 59 | 71 2000 | 31 27 | 58 2001 | 25 49 | 74 2002 | 29 35 | 64 2003 | 36 32 | 68 2004 | 27 16 | 43 2005 | 46 22 | 68 2006 | 29 24 | 53 2007 | 30 22 | 52 2008 | 20 19 | 39 2009 | 18 39 | 57 2010 | 26 19 | 45 2011 | 20 10 | 30 2012 | 26 16 | 42 2013 | 29 17 | 46 -----------+----------------------+---------- Total | 411 465 | 876 . matrix list freq; freq[16,2] c1 c2 r1 7 59 r2 12 59 r3 31 27 r4 25 49 r5 29 35 r6 36 32 r7 27 16 r8 46 22 r9 29 24 r10 30 22 r11 20 19 r12 18 39 r13 26 19 r14 20 10 r15 26 16 r16 29 17 . matrix list names; names[16,1] c1 r1 1998 r2 1999 r3 2000 r4 2001 r5 2002 r6 2003 r7 2004 r8 2005 r9 2006 r10 2007 r11 2008 r12 2009 r13 2010 r14 2011 r15 2012 r16 2013 . putexcel A1=("year") B1=("offensive") C1=("defensive") using z:/trp/data/ > trp_yearlycount1.xlsx, replace; file z:/trp/data/trp_yearlycount1.xlsx saved

Upload: minhyoung-kang

Post on 29-Jan-2016

4 views

Category:

Documents


0 download

DESCRIPTION

.

TRANSCRIPT

Page 1: Barchart Proportion.log

---------------------------------------------------------name: <unnamed>log: z:\trp\log\trp_barchart_proportion.log

log type: textopened on: 19 Aug 2015, 00:00:25.. #delimit;delimiter now ;. ********************************************************************************* Trial> Research Paper: Create Time-Series Dataset by year**************************************> *****************************************;. use z:/trp/data/trp_table1.dta, clear;. set scheme s2mono;. ** construct table;. drop if offensive == 0 & defensive == 0;(3 observations deleted). tab year defensive, matcell(freq) matrow(names);

| defensiveyear | 0 1 | Total

-----------+----------------------+----------1998 | 7 59 | 661999 | 12 59 | 712000 | 31 27 | 582001 | 25 49 | 742002 | 29 35 | 642003 | 36 32 | 682004 | 27 16 | 432005 | 46 22 | 682006 | 29 24 | 532007 | 30 22 | 522008 | 20 19 | 392009 | 18 39 | 572010 | 26 19 | 452011 | 20 10 | 302012 | 26 16 | 422013 | 29 17 | 46

-----------+----------------------+----------Total | 411 465 | 876

. matrix list freq;freq[16,2]

c1 c2r1 7 59r2 12 59r3 31 27r4 25 49r5 29 35r6 36 32r7 27 16r8 46 22r9 29 24r10 30 22r11 20 19r12 18 39r13 26 19r14 20 10r15 26 16r16 29 17. matrix list names;names[16,1]

c1r1 1998r2 1999r3 2000r4 2001r5 2002r6 2003r7 2004r8 2005r9 2006r10 2007r11 2008r12 2009r13 2010r14 2011r15 2012r16 2013. putexcel A1=("year") B1=("offensive") C1=("defensive") using z:/trp/data/> trp_yearlycount1.xlsx, replace;file z:/trp/data/trp_yearlycount1.xlsx saved

Page 2: Barchart Proportion.log

. putexcel A2=matrix(names) B2=matrix(freq) using z:/trp/data/trp_yearlycount1.xlsx, modif> y;file z:/trp/data/trp_yearlycount1.xlsx saved. clear;. import excel z:/trp/data/trp_yearlycount1.xlsx, sheet("Sheet1") firstrow;. gen offper = offensive / (offensive + defensive);. gen all = offensive + defensive;. graph bar (asis) all, over(year) scale(*.85) outergap(*.5) ytitle("annual inciden> ce of labor protests");. graph save z:/trp/gph/fig3.gph, replace;(file z:/trp/gph/fig3.gph saved)

020

4060

80an

nual

inci

denc

e of

labo

r pro

test

s

1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013

. graph bar (asis) offensive defensive, over(year) stack percent yline(50) scale(*> .85) outergap(*.5) ytitle("percentage of labor protests");. graph save z:/trp/gph/fig4.gph, replace;(file z:/trp/gph/fig4.gph saved)

Page 3: Barchart Proportion.log

020

4060

8010

0pe

rcen

tage

of l

abor

pro

test

s

1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013

offensive defensive

. use z:/trp/data/trp_table1.dta, clear;

. gen empl=0;

. replace empl=1 if regular==1;(576 real changes made). replace empl=0 if nonregular==1;(17 real changes made). replace empl=9 if (regular==0 & nonregular==0) | (regular==1 & nonregular==1);(90 real changes made). tab year employment, matcell(freq) matrow(names);

| employmentyear | 0 1 9 | Total

-----------+---------------------------------+----------1998 | 1 60 3 | 641999 | 1 67 0 | 682000 | 4 44 5 | 532001 | 15 50 2 | 672002 | 8 53 1 | 622003 | 24 37 4 | 652004 | 14 27 3 | 442005 | 31 28 5 | 642006 | 24 16 11 | 512007 | 27 15 8 | 502008 | 18 18 3 | 392009 | 12 41 3 | 562010 | 13 29 3 | 452011 | 9 16 5 | 302012 | 9 28 0 | 372013 | 18 28 0 | 46

-----------+---------------------------------+----------Total | 228 557 56 | 841

Page 4: Barchart Proportion.log

. matrix list freq;freq[16,3]

c1 c2 c3r1 1 60 3r2 1 67 0r3 4 44 5r4 15 50 2r5 8 53 1r6 24 37 4r7 14 27 3r8 31 28 5r9 24 16 11r10 27 15 8r11 18 18 3r12 12 41 3r13 13 29 3r14 9 16 5r15 9 28 0r16 18 28 0. matrix list names;names[16,1]

c1r1 1998r2 1999r3 2000r4 2001r5 2002r6 2003r7 2004r8 2005r9 2006r10 2007r11 2008r12 2009r13 2010r14 2011r15 2012r16 2013. putexcel A1=("year") B1=("non-regular workers") C1=("regular workers") D1=("both> or unspecified") using z:/trp/data/trp_yearlycount2.xlsx, replace;file z:/trp/data/trp_yearlycount2.xlsx saved. putexcel A2=matrix(names) B2=matrix(freq) using z:/trp/data/trp_yearlycount2.xlsx, modif> y;file z:/trp/data/trp_yearlycount2.xlsx saved. clear;. import excel z:/trp/data/trp_yearlycount2.xlsx, sheet("Sheet1") firstrow;. graph bar (asis) nonregular regular both, yline(50) over(year) stack perce> nt scale(*.85) outergap(*.5) ytitle("percentage of labor protests");. graph save z:/trp/gph/fig5.gph, replace;(note: file z:/trp/gph/fig5.gph not found)(file z:/trp/gph/fig5.gph saved)

Page 5: Barchart Proportion.log

020

4060

8010

0pe

rcen

tage

of l

abor

pro

test

s

1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013

non-regular workers regular workersboth or unspecified

. log close;name: <unnamed>log: z:\trp\log\trp_barchart_proportion.log

log type: textclosed on: 19 Aug 2015, 00:00:29---------------------------------------------------------