Announcement

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

  • How to make a line graph to reflect the figures of 8 courses that are 8 variables

    I'm trying to do it with this code, but it doesn't work for me

    foreach i of numlist 1/8 {
    twoway (line enrollmentc`i' completedc`i', ///
    title("Evolución de cursos matriculados y completados para cada subvariable") ///
    xlabel("Iteraciones") ///
    ylabel("Número de cursos") ///
    ytitle("Número de cursos", format(%2.2f)) ///
    legend(label(1 "Matriculados") label(2 "Completados")) ///
    if t_1==1 | t_2==1), ///
    title("") ///
    xlabel("") ///
    ylabel("") ///
    legend(off)
    }

    What I expect the graph to record are the percentages for each of those 8 courses for the completedc and enrollmentc variable for 3 scenarios, the first when t_1==1 | t_2==1, for the second scenario when treatment==1 and for the second scenario when treatment==2

  • #2
    You should show the error message that you get from running the code.

    legend(label(1 "Matriculados") label(2 "Completados")) ///
    if t_1==1 | t_2==1)
    The -if- qualifier cannot be part of the options. Perhaps try

    Code:
    legend(label(1 "Matriculados") label(2 "Completados"))) ///
    if t_1==1 | t_2==1
    That is, close out the (line ...) plot and have the -if- qualifier outside this. Otherwise, show exactly what you typed and the error. You should ensure that the command runs before looping the code.

    Comment

    Working...
    X