Announcement

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

  • Combining and overlapping graphs using values within variables

    Hi everyone,

    I have four variables, Country, AgeCategory, EducationLevel, and Wages. I am trying to create a line graph of wages for Agecategory by educationlevel. I used following command:
    twoway line Wages AgeCategory if Country=="Nepal", by(Educationlevel)

    With this command I get two graphs for two values I have within education level. However, I want to have both lines for education level categories overlapped in the same graph so that I can repeat the command for other countries and combine the graphs. Wages and Agecategory are numeric variable while others are string. I had to make destring agecategory because linegraph was showing typemismatch error. Any help would be appreciated. Thanks.

  • #2
    Hi Adhikari,

    Please try the following code and see if it achieves what you were hoping:
    Code:
    twoway line Wages AgeCategory if Country=="Nepal" & Educationlevel==1 || ///
    line Wages AgeCountry if Country=="Nepal" & Educationlevel==2
    Where '1' and '2' for Educationlevel are replaced by the actual values contained within that variable in your data. These could be strings, and so you would need to replace 1 and 2 with the labels in double quotes (e.g. "College")

    Comment

    Working...
    X