Announcement

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

  • How to

    I have quite a simple problem. But STATA is new to me.

    my code is :

    y age gender: egen UIdur_mean = mean(UIdur)
    sort age gender

    and I should Plot the average unemployment duration created by age, separately for men and women.
    How to code that?

    Matt

  • #2
    I'm assuming that the "average unemployment duration" refers to the variable Uldur_mean, is that right? And by "created by age" you mean "associated with age?"

    If I have those assumptions right:

    Code:
    graph twoway line Uldur_mean age, by(gender) sort
    Two comments about your post.

    1. The devil is always in the details. The code you posted, -y age gender: egen UIdur_mean = mean(UIdur)- would get you no new variable, just a syntax error. Presumably that y at the beginning is a typo for -by-. But it's very important when discussing code to get it exactly the way it was. So when presenting code you have tried, you should not type it in here. You should copy/paste directly from your do-file, log-file, or the Results window and make no edits whatsoever. For maximum readability, you should also surround it by code delimters, as I have done above. If you are not familiar with code delimiters, please read the Forum FAQ with attention to #12.

    2. In the future, please give your posts informative titles. People come to this forum and search for previously posted solutions to their problems. "How to" will never be picked up by somebody looking for advice on how to plot a graph.

    Comment

    Working...
    X