Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create a simple graph about contract lenght in days?

    Hi everyone,

    I would like to obtain a graph similar to this one. Here is what I want please:
    1. I want one graph with contract length on the y-axis, and on the x-axis my date variable, but only months-years (like in %tm format) please, not my dates in %td format. So for example, for contracts started the 01jun2016, let's say, how many contract were signed on that day. My variable relative to starting date of contracts is -date_contract_start- (cf. below my dataex).
    2. I want also the same graph as below. The contract lenght in days is represented by my variable -between_dates-
    Click image for larger version

Name:	graph_example.png
Views:	1
Size:	21.9 KB
ID:	1734555

    However, the only thing that I obtain is this strange thing:


    Click image for larger version

Name:	Contract_length.png
Views:	1
Size:	76.5 KB
ID:	1734556



    I simply use the following code to test it:


    Code:
    graph twoway spike between_dates date_contract_start
    Could anyone help me please?


    Here is a dataex;


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long id double(date_contract_start date_contract_end) float between_dates long idcontrato
    1001 18887 21700 2813    1001
    1001 21701 22431  730  451697
    1001 22432 22645  213 1236132
    1001 22646 22676   30 1730454
    1001 22677 22735   58 2082075
    1001 22736 23010  274 2172904
    1001 23011 23069   58 2872183
    1001 23070     .    . 3107888
    1005 18800 21639 2839    1005
    1005 21640 21651   11  420392
    end
    format %td date_contract_start
    format %td date_contract_end
    Thank you in advance for your help.
    Best,

    Michael


Working...
X