Hello everyone, Iam trying to do a graph of multiple lines. What I want is a graph that shows in a same graph diffmain, diff4,diff5,diff21 and diff34 as shown in the image. Iam trying to do it with a loop but it does not work, anyone has an idea of how to run it?

Code:
levelsof state if (state ==4|state ==5|state==21|state==34), local(levels) 
4 5 21 34

use "PS2_data", clear
levelsof state if (state ==4|state ==5|state==21|state==34), local(levels) 
use "total_results34",clear
 
  foreach l of local levels {
  drop if rmspe`l'>=2*rmspemain
  twoway (line diffmain _time,color(black)), name(gmain,replace)
  twoway ((line diff`l' _time,color(gray)), xline(1989,lcolor(gray) lpattern(dash)) yline(0,lcolor(gray) lpattern(dash))), name(g`l',replace)
  graph combine gmain g`l'
 }


Code:
 _time rmspemain diffmain rmspe4 diff4 rmspe5 diff5 rmspe21 diff21 rmspe34 diff34)
1970 1.954279   4.857199 2.680468   7.661901 2.1965363   6.316099 3.5513296    10.3319 3.185257   9.161399
1971 1.954279  1.8468013 2.680468   4.467302 2.1965363   1.678701 3.5513296     4.8542 3.185257  4.4762006
1972 1.954279  -.8392038 2.680468   2.714297 2.1965363   .7133963 3.5513296  -2.419502 3.185257  -2.767302
1973 1.954279 -2.0618958 2.680468  2.5514026 2.1965363  -1.788496 3.5513296 -1.9223986 3.185257 -1.2888986
1974 1.954279  -.3828028 2.680468  1.7265977 2.1965363  -.2369025 3.5513296  -.5969042 3.185257   .1664961
1975 1.954279   .5749984 2.680468  .24679898 2.1965363   .3920981 3.5513296  1.0028981 3.185257  1.4219983
1976 1.954279   .3586017 2.680468   .6195006 2.1965363 -.09239785 3.5513296  -.3425991 3.185257   .9643013
1977 1.954279  1.5313005 2.680468  1.0875012 2.1965363   1.366001 3.5513296  -.9009992 3.185257  .35590065
1978 1.954279     2.3699 2.680468   1.039699 2.1965363  2.0144997 3.5513296   .8982986 3.185257  1.6601986
1979 1.954279 -1.4309988 2.680468    -2.4031 2.1965363  -1.730199 3.5513296 -1.1398989 3.185257  -.5653989
1980 1.954279 -.13320343 2.680468   .1253957 2.1965363  -.3608031 3.5513296  -1.229802 3.185257  -1.349701
1981 1.954279 -2.0308006 2.680468     -1.513 2.1965363  -2.757701 3.5513296 -2.3394022 3.185257 -2.7693014
1982 1.954279  -.9976991 2.680468  -.5988988 2.1965363 -1.8019996 3.5513296  -2.633698 3.185257 -2.3449986
1983 1.954279  -.9086969 2.680468  1.0149046 2.1965363 -1.1320968 3.5513296  -4.579699 3.185257  -4.761999
1984 1.954279  1.3141013 2.680468   3.783601 2.1965363   1.093001 3.5513296 -4.6354966 3.185257 -3.2002964
1985 1.954279  -.8733967 2.680468   .3187043 2.1965363 -1.5047966 3.5513296  -3.321697 3.185257  -2.688096
1986 1.954279 -1.2375056 2.680468  .05029415 2.1965363 -1.1422058 3.5513296 -3.9199016 3.185257  -3.229702
1987 1.954279 -3.6921985 2.680468  -2.598498 2.1965363  -4.066399 3.5513296 -3.0094006 3.185257 -2.0427008
1988 1.954279    -2.3528 2.680468 -2.7908006 2.1965363 -1.5935994 3.5513296 -2.8035014 3.185257 -1.9126003
1989 1.954279  -7.688198 2.680468  -9.372597 2.1965363  -7.157198 3.5513296    -5.6707 3.185257 -4.5439997
1990 1.954279  -9.518498 2.680468  -9.311898 2.1965363  -9.742398 3.5513296 -10.726597 3.185257 -11.082798
1991 1.954279 -13.776502 2.680468 -13.709203 2.1965363   -13.9996 3.5513296 -18.012802 3.185257 -16.981604
1992 1.954279   -13.3233 2.680468   -14.2893 2.1965363   -13.5949 3.5513296   -18.1126 3.185257 -17.167501
1993 1.954279 -17.057299 2.680468   -17.5239 2.1965363 -17.500498 3.5513296 -21.837196 3.185257 -20.791197
1994 1.954279   -20.9162 2.680468   -21.6492 2.1965363   -21.8273 3.5513296   -26.5969 3.185257   -27.2637
1995 1.954279   -19.8731 2.680468   -22.1855 2.1965363   -20.6644 3.5513296   -24.5541 3.185257   -23.0643
1996 1.954279   -21.0376 2.680468   -23.1864 2.1965363    -21.874 3.5513296   -24.3403 3.185257   -22.0078
1997 1.954279   -21.4709 2.680468   -24.2357 2.1965363   -22.5902 3.5513296   -24.3264 3.185257   -21.6234
1998 1.954279   -19.1829 2.680468   -20.5654 2.1965363   -20.3489 3.5513296   -26.0876 3.185257   -25.0846
1999 1.954279   -24.5438 2.680468   -26.1011 2.1965363   -25.6143 3.5513296   -27.8567 3.185257   -27.7196
2000 1.954279   -24.2594 2.680468   -25.1009 2.1965363   -25.0719 3.5513296   -27.6924 3.185257   -26.4853
end
Array