Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: gr bar for string variable


From   "b. water" <barleywater@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: gr bar for string variable
Date   Fri, 7 Mar 2008 00:53:33 +0000

dear listers,

stata 8.2,

i have data set-up like this:

injurytype	year
typeII	2007
minimal	2003
typeII	2003
minimal	2003
typeIII	2005
typeIV	2006

and so on (the range of the injury type is minimal, typeI to typeIV while the year is 2003 - 2007).

i am building a graph bar like the one in stata v. 8 [G] page 135 where in place of region 1 in the example, i would have the year and instead of 1 to 9 regional division, i would have the 5 types of injury (i.e. minimal, typeI to typeIV). following my earlier query (around new year's time), i did:

gen x=1
gr bar (count) x, over(injurytype) over(year)

which produces the one of the graph that i want except for one thing: the injury types, displayed on x-axis suffered from 'overprinting'. i know i can try:

gr hbar (count) x, over(injurytype) over(year) ysize(10)

which did solve the overprinting but i would be grateful if anyone can tell me:

1. how can i make, instead, each bar to be of a different color and displaying the color legend (e.g. red for minimal etc), so that i can suppress injurytype being shown on the x-axis (but still displaying the year) (someone need to tell me how to achieve this), and

2. how can i, instead of a -count-, produce a proportion or percentage of each type of injury over (year) i.e. on a graph bar, the y-axis would shows either proportion or percentage rather than count.

thank you for advice/help.

regards,
bw
 
_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index