Announcement

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

  • Descriptive statistics

    Hi
    I have a datset containing the variables cid, yr, a, TA and growth. Variable a is a dummy variable that is 1 at the year of the treatment. sum_a were created to identify 3 years before and after the treatment.

    I have trouble making some descriptive statistics. I want to make a graph or histogram that displays number of treatments for each year, but not the years with zero treatments.

    I also want to make a graph that divide up the treatments by TA and growth:

    For example: How many cid was in the small, medium and big bracket 1 year before the treatment?
    Small: < 10
    Medium: 10 to 50
    Big: > 50

    or: How many cid was in the negative, moderat and high bracket 1 year before the treatment?
    Negative: < 0,0
    Moderat: 0,0 - 0,1
    High: > 0,1

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(cid year a sum_a TA growth)
    1 2000 0 1 75 -.02
    1 2001 0 1 80 -.01
    1 2002 0 1 85 -.05
    1 2003 1 1 70 -.08
    1 2004 0 1 85 -.01
    1 2005 0 1 110 -.05
    1 2006 0 1 130 -.007
    2 2004 0 1 10 0.01
    2 2005 0 1 15 0.03
    2 2006 0 1 15 0.07
    2 2007 1 1 5 0.03
    2 2008 0 1 15 0.1
    2 2009 0 1 25 0.2
    2 2010 0 1 40 0.15
    3 2009 0 1 133 0.2
    3 2010 0 1 143 0.15
    3 2011 0 1 153 0.14
    3 2012 1 1 110 0.23
    3 2013 0 1 130 0.45
    3 2014 0 1 170 0.76
    3 2015 0 1 180 0.23
    end
    Any help would be much appreciated.

    Thanks in advance,
    Heath Stapo

  • #2
    You need to carefully read the introductory material and the Users Guide.

    Also, look at the graph documentation especially twoway. The graph routines generally like to have all values of the x variables, so you might have to recode year if you don't want all the years.

    You should also look at the generate command. Most of your later questions can be answer by some generate and replace commands and then summary with by values (bysort z: sum x).

    Comment

    Working...
    X