Hi,
I have a panel data where my time variables are year (2000-2015) and quarter (1-4), and have five observations of interest (variable rssd9001==1951350 | rssd9001==2380443 ....).
While I have been able to plot all 4 ratios ("finlev loan2deposit loan2asset nim" stored as variables) in one chart for each observation of interest (5) by using the code below (photo one), I would like to do the opposite now --- plot all five observations of interest by in one chart for each individual ratios (4), as shown in photo three.
When I do plot them, each time series has the same label (name of the ratio), and thus I cannot differentiate between the observations of interest (photo 2). Thus, any comments on automating the correct labeling of individual series would be very helpful (moving from photo 2 to photo 3). Thank you.
I have a panel data where my time variables are year (2000-2015) and quarter (1-4), and have five observations of interest (variable rssd9001==1951350 | rssd9001==2380443 ....).
While I have been able to plot all 4 ratios ("finlev loan2deposit loan2asset nim" stored as variables) in one chart for each observation of interest (5) by using the code below (photo one), I would like to do the opposite now --- plot all five observations of interest by in one chart for each individual ratios (4), as shown in photo three.
When I do plot them, each time series has the same label (name of the ratio), and thus I cannot differentiate between the observations of interest (photo 2). Thus, any comments on automating the correct labeling of individual series would be very helpful (moving from photo 2 to photo 3). Thank you.
Code:
generate time= yq(year,quarter) label var time "Time" tsset rssd9001 time, quarterly twoway (tsline finlev loan2deposit loan2asset nim if rssd9001==1951350, /// recast(connected)), ytitle(Ratio) title("CitiGroup") graph export "\\Client\E$\banking\CitiGroup Ratios.png", as(png) replace twoway (tsline finlev if rssd9001==1951350) (tsline finlev if rssd9001==2380443) /// (tsline finlev if rssd9001==1111435) (tsline finlev if rssd9001==1275216) /// (tsline finlev if rssd9001==3232316), /// ytitle(Ratio) title("Financial Leverage") subtitle("2000 - 2015") graph export "\\Client\E$\banking\Fin Lev.png", as(png) replace
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double rssd9001 float(year quarter finlev loan2deposit loan2asset nim) 1111435 2000 1 17.6616 . . . 1111435 2000 2 18.048634 . . . 1111435 2000 3 17.379684 . . . 1111435 2000 4 17.712454 . . . 1111435 2001 1 16.159634 .4994674 .091528 . 1111435 2001 2 16.069832 .4808755 .08482818 . 1111435 2001 3 16.235725 .381733 .09002786 . 1111435 2001 4 15.38442 .4882234 .08447587 . 1111435 2002 1 15.693042 .29532418 .07393968 . 1111435 2002 2 16.212132 .3503276 .08237515 . 1111435 2002 3 15.385085 .3175183 .0751999 . 1111435 2002 4 15.638468 .311908 .05906318 . 1111435 2003 1 12.958388 .4389146 .07281883 . 1111435 2003 2 13.522996 .3956076 .08509956 . 1111435 2003 3 13.098245 .4671533 .08235218 . 1111435 2003 4 12.971867 .45018625 .06635084 . 1111435 2004 1 13.380816 .3470571 .06040077 . 1111435 2004 2 13.62336 .3651535 .05740127 . 1111435 2004 3 14.064837 .3450653 .05444818 . 1111435 2004 4 13.141537 .2782355 .0486441 . 1111435 2005 1 16.61069 .3696912 .04791223 . 1111435 2005 2 16.688457 .4752974 .06062539 . 1111435 2005 3 17.043633 .6867796 .07826404 . 1111435 2005 4 15.38606 .5526849 .06575649 . 1111435 2006 1 16.24364 .6890419 .08566052 . 1111435 2006 2 15.857952 .7196737 .08458354 . 1111435 2006 3 16.013828 .9149318 .0818535 . 1111435 2006 4 14.808558 .8014799 .08309656 . 1111435 2007 1 14.743403 .9291276 .0920631 . 1111435 2007 2 14.499681 .9368418 .1072609 . 1111435 2007 3 12.452477 .3895432 .08060987 . 1111435 2007 4 12.639305 .54789275 .11044004 . 1111435 2008 1 14.283253 .44381 .09635971 .01568829 1111435 2008 2 10.429069 .6103395 .10010009 .03223691 1111435 2008 3 21.93017 .21930033 .06079108 .03065256 1111435 2008 4 13.818038 .2458166 .0515941 .05650061 1111435 2009 1 10.44582 .29778033 .0527672 .011947745 1111435 2009 2 12.633157 .6111127 .08209448 .02360953 1111435 2009 3 12.106215 .6129812 .07009166 .033114996 1111435 2009 4 10.814826 .600049 .06844211 .04457283 1111435 2010 1 9.920643 .5679855 .07997213 .01172667 1111435 2010 2 10.003572 .5322698 .07261872 .024330346 1111435 2010 3 9.760876 .51313525 .07968388 .03384772 1111435 2010 4 8.933007 .4860419 .07462598 .04968682 1111435 2011 1 8.870421 .4883891 .07428312 .01282593 1111435 2011 2 9.523307 .4515805 .068143256 .02390843 1111435 2011 3 10.534927 .2658638 .05656029 .03394769 1111435 2011 4 11.144163 .1515712 .04634812 .03871478 1111435 2012 1 9.296103 .310191 .06531245 .0110872 1111435 2012 2 10.069118 .2370824 .06157691 .0214115 1111435 2012 3 9.837753 .2728902 .068697795 .03320301 1111435 2012 4 10.647666 .19403565 .05528269 .03925665 1111435 2013 1 10.438546 .26966608 .06409463 .01032024 1111435 2013 2 11.302807 .28795475 .0722893 .02105759 1111435 2013 3 10.609234 .3044683 .07176776 .032472715 1111435 2013 4 11.92441 .1721562 .05537757 .03803759 1111435 2014 1 12.063601 .1825392 .06266337 .00888846 1111435 2014 2 13.008243 .16660415 .05938825 .016738558 1111435 2014 3 12.98808 .2031406 .06682422 .02666578 1111435 2014 4 12.76446 .17586008 .06625273 .03530755 1111435 2015 1 13.423992 .17714643 .06540118 .009072536 1111435 2015 2 13.70097 .1601693 .062961236 .017073259 1111435 2015 3 11.483948 .2143302 .07691251 .031995542 1275216 2009 1 7.618366 2.744755 .5222931 . 1275216 2009 2 8.706392 2.3838103 .5090194 .09331473 1275216 2009 3 8.637955 2.0683222 .4907692 .13759337 1275216 2009 4 8.614534 1.9901243 .50098294 .18726218 1275216 2010 1 10.729995 2.602302 .58918124 .03836207 1275216 2010 2 9.830609 2.619053 .6023496 .0813177 1275216 2010 3 9.103566 2.6464646 .5999075 .12368578 1275216 2010 4 8.97195 2.710458 .6416867 .1694678 1275216 2011 1 8.173214 2.5197365 .6395732 .04395397 1275216 2011 2 8.056067 2.590021 .6489663 .0899867 1275216 2011 3 8.153494 2.525353 .6416925 .13488401 1275216 2011 4 8.101351 2.3753335 .66036 .1792363 1275216 2012 1 7.6321 2.363555 .6590296 .04938979 1275216 2012 2 7.693884 2.503957 .6826349 .10495383 1275216 2012 3 7.852116 2.4729886 .67225 .15301016 1275216 2012 4 8.119073 2.407462 .6969521 .2021255 1275216 2013 1 8.115812 2.309677 .665819 .04899364 1275216 2013 2 7.980047 2.399882 .697605 .10438946 1275216 2013 3 7.809434 2.2849581 .7015025 .1580822 1275216 2013 4 7.864387 2.436889 .7195786 .2098007 1275216 2014 1 7.580156 2.3474698 .7110108 .05223218 1275216 2014 2 7.535555 2.449447 .7268742 .10754456 1275216 2014 3 7.607515 2.4204724 .7178575 .1568442 1275216 2014 4 7.693197 2.4233766 .7195967 .20738053 1275216 2015 1 7.085711 2.3024108 .7106818 .04783708 1275216 2015 2 7.18129 2.274748 .7209258 .09802198 1275216 2015 3 7.228472 2.1743863 .7306378 .1498432 1951350 2000 1 13.003435 . . . 1951350 2000 2 13.908412 . . . 1951350 2000 3 13.663926 . . . 1951350 2000 4 12.625384 . . . 1951350 2001 1 12.773776 4.054651 .4156939 . 1951350 2001 2 12.63721 3.88028 .4150732 . 1951350 2001 3 12.383056 3.458763 .39203125 . 1951350 2001 4 11.757897 3.11867 .3897855 . 1951350 2002 1 11.303982 2.909966 .3847656 . 1951350 2002 2 11.29538 3.106562 .387703 . 1951350 2002 3 11.675133 3.001552 .4068166 . 1951350 2002 4 11.561904 2.7307005 .4245591 . 1951350 2003 1 11.886186 2.623962 .4007025 . 1951350 2003 2 11.666077 2.679104 .3884654 . 1951350 2003 3 11.591158 2.68499 .38516185 . 1951350 2003 4 11.90058 2.794109 .3893572 . 1951350 2004 1 12.625683 2.762603 .378764 . 1951350 2004 2 13.864195 2.895146 .3820888 . 1951350 2004 3 13.658052 2.909969 .3788023 . 1951350 2004 4 13.351635 2.993781 .3872971 . 1951350 2005 1 13.229363 2.883223 .3839496 . 1951350 2005 2 13.392423 2.9610696 .37691635 . 1951350 2005 3 12.967694 2.949329 .4002199 . 1951350 2005 4 13.110533 2.964968 .4078734 . 1951350 2006 1 13.696698 2.971904 .4001782 . 1951350 2006 2 13.933108 3.09861 .4094781 . 1951350 2006 3 14.65219 3.1076615 .3914759 . 1951350 2006 4 15.38269 3.0375514 .3759206 . 1951350 2007 1 16.15687 3.068293 .361342 . 1951350 2007 2 16.670164 3.306683 .3544126 . 1951350 2007 3 17.729725 3.3706536 .3570403 . 1951350 2007 4 18.397987 3.1673825 .385038 . 1951350 2008 1 16.607513 3.120525 .3828978 -.00008774744 1951350 2008 2 14.904804 3.0775516 .38148054 .002447388 1951350 2008 3 15.828194 2.751455 .3717367 .0046452167 1951350 2008 4 13.45954 2.3948824 .3580556 .0006419073 1951350 2009 1 12.489655 2.195875 .3587671 .008098723 1951350 2009 2 12.01231 2.044852 .3436979 .01899599 1951350 2009 3 13.245074 1.9063526 .3244183 .02388636 1951350 2009 4 12.017527 1.9243485 .313361 .02065656 1951350 2010 1 13.020067 2.3597338 .3507474 .006383428 1951350 2010 2 12.31587 2.264185 .35165015 .011525917 1951350 2010 3 12.006562 2.230548 .339596 .015307586 1951350 2010 4 11.544204 2.0995705 .3333541 .01914968 1951350 2011 1 11.233528 2.0675526 .3230486 .005332615 1951350 2011 2 10.952594 2.0889063 .3277039 .01020217 1951350 2011 3 10.794973 1.96592 .326599 .015428705 1951350 2011 4 10.435188 1.8821957 .3446943 .01906608 1951350 2012 1 10.583448 1.8405732 .3318151 .00344759 1951350 2012 2 10.312426 1.8272548 .3374258 .007874742 1951350 2012 3 10.232947 1.7370133 .335814 .0087967375 1951350 2012 4 9.762772 1.716652 .34728265 .012816698 1951350 2013 1 9.633171 1.6675507 .3408 .005282608 1951350 2013 2 9.523459 1.633595 .3422941 .010742056 1951350 2013 3 9.369243 1.6452466 .3434505 .014552006 1951350 2013 4 9.135874 1.5938334 .34971955 .01864174 1951350 2014 1 9.025374 1.575465 .34608185 .005275286 1951350 2014 2 8.974581 1.5902447 .3495097 .00994286 1951350 2014 3 8.8154125 1.5772846 .34671515 .014875393 1951350 2014 4 8.702011 1.557486 .3499357 .01878422 1951350 2015 1 8.479657 1.538521 .3460873 .005150238 1951350 2015 2 8.284252 1.603225 .35408854 .01004446 1951350 2015 3 8.140724 1.5556467 .3514656 .014639172 2380443 2009 1 14.328176 .6511772 .027240124 .01014431 2380443 2009 2 13.962715 .7609668 .03038184 .02672015 2380443 2009 3 13.30734 .7727017 .031185724 .04185621 2380443 2009 4 11.8516 .9678198 .03729002 .05386538 2380443 2010 1 11.91263 1.079693 .03833641 .01564031 2380443 2010 2 11.81378 .9937807 .034181107 .02581885 2380443 2010 3 11.880057 1.1507887 .03997865 .035452202 2380443 2010 4 11.649665 1.45811 .05165857 .04397639 2380443 2011 1 12.726084 1.647365 .0569616 .013441656 2380443 2011 2 12.74259 1.6472383 .05587862 .02108447 2380443 2011 3 13.265654 1.396849 .04977616 .02410116 2380443 2011 4 12.85996 1.394939 .0580058 .03062314 2380443 2012 1 13.024483 1.338495 .06015662 .011115393 2380443 2012 2 12.810564 1.192502 .06194223 .018187987 2380443 2012 3 12.65528 1.0728298 .06047552 .027392274 2380443 2012 4 12.315937 1.1156453 .07400002 .03802232 2380443 2013 1 12.354185 1.0819141 .07137914 .011256577 2380443 2013 2 11.974523 1.0285242 .06615307 .021602076 2380443 2013 3 11.834294 1.0678716 .07115759 .029320363 2380443 2013 4 11.569492 1.3371967 .08935328 .0396448 2380443 2014 1 11.536732 1.2196584 .08156229 .010703775 2380443 2014 2 10.50815 1.290747 .0921945 .02290154 2380443 2014 3 10.511867 1.3578738 .10109264 .032740865 2380443 2014 4 10.291956 1.260632 .10180883 .04348822 2380443 2015 1 10.117504 1.1718671 .0989784 .014029665 2380443 2015 2 9.738093 1.2265137 .1052432 .025835983 2380443 2015 3 9.993156 1.223331 .10606889 .034070008 3232316 2004 1 10.073924 3.584469 .5971729 . 3232316 2004 2 10.890134 3.404658 .5970777 . 3232316 2004 3 11.255392 3.69605 .6076691 . 3232316 2004 4 11.737456 3.6852074 .6197172 . 3232316 2005 1 11.715747 3.718832 .6198384 . 3232316 2005 2 11.648606 3.6971526 .6092629 . 3232316 2005 3 12.147215 3.747263 .6101354 . 3232316 2005 4 12.07611 3.7902975 .6275083 . 3232316 2006 1 12.448612 3.668826 .58774006 . 3232316 2006 2 12.71479 3.61586 .5846155 . 3232316 2006 3 12.9036 3.687368 .57823485 . 3232316 2006 4 13.388294 3.6162734 .5769462 . 3232316 2007 1 13.597178 3.404685 .56885594 . 3232316 2007 2 13.472528 3.6487424 .56734926 . 3232316 2007 3 14.966816 3.550507 .5527243 . 3232316 2007 4 17.583902 3.415116 .5714835 . 3232316 2008 1 15.81408 3.101638 .54626375 .005224875 3232316 2008 2 15.40988 3.12186 .5592763 .0053026 3232316 2008 3 14.609724 2.934245 .53082293 .013890913 3232316 2008 4 14.346217 2.699086 .529393 .017237592 3232316 2009 1 12.238377 2.547951 .53178924 .016804645 3232316 2009 2 12.70482 2.447497 .53358036 .007118239 3232316 2009 3 12.94227 2.2935066 .5070542 .00801777 3232316 2009 4 13.460788 2.112522 .4877654 .012792975 3232316 2010 1 11.83777 1.616399 .421826 .005591531 3232316 2010 2 11.406465 1.5358696 .4221248 .009894632 3232316 2010 3 11.79187 1.464699 .3854877 .012777698 3232316 2010 4 11.664003 1.3936226 .38874525 .017516311 3232316 2011 1 10.65013 1.300919 .3479595 .003643978 3232316 2011 2 10.197634 1.2761304 .3435937 .007660963 3232316 2011 3 9.670562 1.209215 .3658476 .007909036 3232316 2011 4 9.284066 1.1803856 .3880193 .01026968 3232316 2012 1 9.471017 1.1759295 .3728075 .001376177 3232316 2012 2 9.060565 .9712085 .3039652 .004921273 3232316 2012 3 9.36672 1.0745387 .3096921 .00627707 3232316 2012 4 9.370165 1.0205193 .3086784 .008695262 3232316 2013 1 8.9400215 1.0236834 .31635645 .0037833825 3232316 2013 2 9.495392 1.0317687 .2948645 .0084328335 3232316 2013 3 9.155878 1.0064332 .3015005 .01108005 3232316 2013 4 8.87187 1.0016373 .3118668 .01286929 3232316 2014 1 9.368738 1.0333422 .29232132 .002843191 3232316 2014 2 8.643744 .9712115 .3178362 .005603204 3232316 2014 3 8.361876 .9958583 .329947 .008681755 3232316 2014 4 8.68626 .9990216 .32898915 .010217796 3232316 2015 1 9.023543 .9763449 .3246716 .0023265667 3232316 2015 2 8.439215 .9381014 .3617079 .005401734 3232316 2015 3 8.8359585 .917338 .3442108 .007324972 end
Comment