Statalist


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

Re: st: Creating a graph


From   "Richard Ohrvall" <richard.ohrvall@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Creating a graph
Date   Sat, 25 Aug 2007 09:14:35 +0200

Thank you so much!

I managed to create the graph I wanted by using Scott's example and
todate as Svend suggested. I will look into Stata's features for
survival analysis.

Richard

On 8/23/07, Svend Juul <SJ@soci.au.dk> wrote:
> Richard wrote:
>
> I have a problem constructing the kind of graph I would like to get. I
> have a dataset containing individuals working within an organisation.
> They have all started working there at the same time, but some have
> left the organisation. I have one variable with a unique ID, one
> variable with their sex, and finally one variable with the data of
> their departure. The final variable is a ordinary text variable in the
> format "yyyymmdd" which is equal to "" for those individuals who are
> still in the organisation.
>
> What I would like to create is a graph with one line representing the
> percentage of men still in the organisation and one line for women,
> ie. the line starts at the value 100 at the time when the organisation
> was set up, say 20021101, and ends at my final data point, say
> 20061231. The y-axis should represent percent and the x-axis time. I
> also would like to create a similar graph with absolute numbers, ie.
> the y-axis would represent the number of individuals instead of
> percent.
>
> -------------------------------------------------------
>
> This looks like a typical survival analysis to me. Look at -stset-
> and -sts graph-. Those still in the organization should be handled as
> censored at the last day of observation.
>
> Before proceeding, you need to convert your string dates to numeric dates.
> If you use Stata 10, it is pretty straightforward (sdate1 being the string
> date, date1 the numeric date):
>
>   generate date1 = date(sdate1,"YMD")
>   format date1 %td
>
> Prior to Stata 10 you might benefit from the unofficial -todate- command:
>
>   findit todate
>
> Hope this helps
> Svend
>
> ________________________________________________________
>
> Svend Juul
> Institut for Folkesundhed, Afdeling for Epidemiologi
> (Institute of Public Health, Department of Epidemiology)
> Vennelyst Boulevard 6
> DK-8000 Aarhus C,  Denmark
> Phone, work:  +45 8942 6090
> Phone, home:  +45 8693 7796
> Fax:          +45 8613 1580
> E-mail:       sj@soci.au.dk
> _________________________________________________________
>
> *
> *   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/
>
*
*   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